Putting hot food dishes into the refrigerator or freezer can dramatically lower the temperature inside the "box" and cause spoilage of other foods as well as run up the cost of power. So I was taught that it's always better to allow the food to cool before introducing it to cold storage. I just want to make sure it doesn't sit around long enough to support bacterial colonization. I allow my prepared dishes to cool on the counter top before putting them in the refrigerator/freezer. I sometimes speed up the process by resting them in a cold water bath for a time. Naturally, I don't put hot glass containers diredtly into cold water. They'd break if I did that. So I allow them to cool enough before the cold water bath so avoid breakage.
When freezing, Imake sure to wrap or cover tightly. Not all plastic wraps are impervious to air flow; even microscopic pores can allow air to pass through. Unless the wrapping is air tight the moisture will leave the food and you'll end up with premature freezer burn.
"Freezer" paper, plastic "freezer" bags or plastic wrap specially designed for freezing foods is the best bet.
I think this is one of those old wives tales... literally. In the past, refrigerators were not quite as strong as they are now. A semi-warm item placed in there could dramatically reduce the inside temp. If your fridge is new, maybe 5-8 years old I don't think it'll have any problems handling warm items. With that said, don't put them on top of a stick of butter or carton of milk. Also, don't be stupid, and don't take a casserole out of a 400 degree oven and place it directly into the freezer. You're just asking for problems there.
Get food out of the danger zone ASAP. Keep it above 140F or below 40F. While it's in the Zone is when it's most prone to getting contaminated.
So, as soon as you're done eating, leftover casserole - or anything else for that matter - should be covered loosely and placed in the refrigerator for an hour before wrapping and freezing. This lowers the temp quickly and helps dry out overly moist foods (too moist makes large ice crystals which destroy the texture of frozen foods when they thaw).
Unless it's a very hot day, I leave the pan on the counter until the food is room temperature. I always put a hot pan atop a wire mesh cooling rack, since it allows air circulation beneath the pan, and wicks off the heat Sometimes I set the rack in cold water as well. I prefer freezer containers to plastic wrap or baggies for most cooked foods. When using baggies, I suck the air out with a straw. I have a vacuum sealer but usually reserve that for raw meats and produce. It's not good with liquids.