It takes about two hours for illness-causing bacteria to grow on perishable food -- and just an hour if the temperature is above 90 degrees F (32 degrees C)[source: Foodsafety.gov]. So stick it in the fridge as soon as possible after cooking it.
There's no need to wait before foods cool down, even if they're really hot, because modern refrigerators are able to handle the strain. However, if you've got a really big item, like a turkey, you'll probably want to cut up the meat and store it in multiple small, flat containers so that it cools more quickly, before bacteria has a chance to develop. (For the same reason, remove the stuffing from the turkey and store it in a separate container.)
Make sure you seal everything, which reduces the chance of cross-contamination. And if you've got leftover canned food, transfer it to a container rather than storing it in an opened tin, because the metal on the rim can leach into the food and give it a metallic taste. Finally, don't stuff the refrigerator too full, because air needs to be able to circulate inside for the fridge to stay cool [sources: Humphreys, Fightbac.org].