The best practice is to cool your wort rather rapidly after boiling it. There are three prime methods for doing this, using tools of increasing complexity. One way to not do it is by pouring a concentrated wort into a fermenter filled with ice. This is a seemingly obvious method but can affect the proteins and such in the beer rather dramatically, so I am told. To properly chill your hot wort, you can use an immersion wort chiller, plate chiller, or counterflow chiller.
My preferred method is to use an immersion wort chiller. This is a coil of metal tubing that is put into the hot liquid, and hooked up to a water tap. The cool water flows through the tubing and absorbs the heat of the beer. Normally the tubing is copper because copper is easy to bend and is excellent at dispersing the heat. I like this method because it is cheap and easy. A coil of 3/8″ copper tubing, total 25′ of it, is easy to make at home. Add on a couple hose fittings and you have a wort chiller. The trick is to keep the outside of it clean. You do not need to sanitize it because you can stick it in the boiling liquid 10 minutes before the end of the boil and it will get sanitized from the heat.
A plate chiller is more efficient than an immersion chiller, but is also more expensive. You can use either gravity or an electric pump to push the hot wort through one side of it while running cool tap water through the other side. The dynamics of the plates inside the device disperse the heat very well and can bring it down to room temperature very rapidly. The downside is that plate chillers can cost a pretty penny and to really use them efficiently you need a pump. In addition, the wort flows through the inside of the device, which you can’t see. I don’t like that. I can’t see if there is any gunk built up there or not. How do I know if it is clean?
A counterflow wort chiller is similar to both of the previous options. You run cool water through one side and hot wort through the other. In this case, though, the form factor is a coiled copper tube that the wort goes through, jacketed by another tube that the cool water runs through. Like the plate chiller, this is a very efficient process. The downside is that it is also very expensive and requires a pump to do it well, although gravity can be your friend with this method as well. However, you still have the problem of the wort going through an unseen, uninspected tube. To me that’s spooky. I don’t like it at all.
A fourth method I have heard of, which is probably the most efficient of all, is to run some coiled copper tube through a basin filled with ice, then run the wort through the tube. This works well and can be done with a gravity feed, so no pump is needed. Again, the wort goes through unseen places, an idea that sticks in my craw. You can do a lot to clean and sanitize the inside of tubes but can’t visually inspect them, so I would sooner not use this method, personally. Others do it all the time and have great results.
You might be able to think of more ways of cooling your wort, and I would love to hear about them. Whichever way you choose, definitely use some way other than simply letting your beer sit around for a day in the fermenter. It works and I did this for years, but it is not the safest way to go if you are concerned with beer infections.