If I left food out of the refrigerator for some period of time, is it still safe? If I left it out too long, can I salvage it by cooking it more?
When in Doubt, Throw it Out! (Answered by SAJ14SAJ)
You cannot see or smell bacterial contamination. Mold that appears to be growing only on the surface may grow invisible roots into softer foods. Do not rely on a visual inspection or "smell test" to tell you whether or not a food is safe.
The Danger Zone
Potentially hazardous food that stays in the temperature "danger zone", 40-140 °F (4-60 °C), for more than 2 hours should be discarded. (Note: this is the FDA's rule. Other agencies may have variations on it. Additionally, government agencies generally make very conservative recommendations—they're trying to make sure that no one who follows the rules gets sick. Breaking the rules means maybe taking on some risk. That's up to you—just remember, eventually someone gets unlucky, and food poisoning is not fun.)
Potentially hazardous foods are those foods that spoil most easily, such as unshelled eggs, raw meats, fish, shell fish, dairy products, almost all cooked foods. This time is cumulative, so it includes time bringing the food home from the grocery store, time before cooking, time after cooking, and so on. The reason is that while cooking may destroy bacteria or other pathogens, it doesn't always destroy the toxins that they have produced.
So in general, regarding perishable foods like meat, most dairy, unshelled eggs and shell eggs in the US, cooked casseroles, and so on: If the food (or its perishable components) have been at room temperature for more than two hours, you should discard that food. To avoid the danger zone, keep cooked food hot until ready to eat, then refrigerate immediately. Separate large items into smaller containers to help them to cool more quickly. If you’re defrosting something, do it in the fridge or under cold running water.
Why does cooking not completely "reset the clock"? Some bacteria leave behind harmful protein toxins that cannot be "killed" (denatured) by cooking. Cooking food is only effective against live organisms, not their toxic waste products. Spoiled food cannot be cooked back to safety and must be discarded.
Cooking is pasteurization, not sterilization. Pasteurization means killing most microbes, so as to render the food safe for human consumption. Sterilization methods (e.g. pressure-canning and irradiation) are the only safe methods for longer-term room-temperature storage. Otherwise, the danger zone rules always apply.
Even sterilized food can only remain sterile under an airtight seal, e.g. when properly canned or vacuum-sealed. Once it is opened, it is no longer sterile. Air contains countless bacteria and molds, and their spores, which will readily re-colonize any suitable environment they encounter. Cooked food tends to be an ideal medium for growth.
Regulation and Risks
Follow the guidelines set out by reputable regulatory agencies, especially when serving others. Local organizations include:
Other regulatory sources apply in other parts of the word, but major food safety organizations usually agree in essence (if not in complete detail) on most issues. Failure to follow reputable guidelines is irresponsible if you are serving guests, and failure to follow your specific local codes is likely to be illegal if you are serving customers. Health codes tend to be very conservative, to fully protect the community. You have the right to take risks on yourself by ignoring their recommendations, but please do not risk the safety of others.
Once again, if you suspect spoilage or contamination, please, throw it out.
Disagree with the answer above? Have your own expertise to contribute? Check out the original post, and see more questions like this at Seasoned Advice, a question and answer site for professional and amateur cooks and chefs. And if you've got your own problem that requires a solution, ask a question (it's free).