Hot foods should be refrigerated as soon as possible within two hours after cooking. But don't keep the food if it's been standing out for more than two hours. Don't taste test it, either. Even a small amount of contaminated food can cause illness.
Date leftovers so they can be used within a safe time. Generally, they remain safe when refrigerated for three to five days. If in doubt, throw it out, "It's not worth a food-borne illness for the small amount of food usually involved."
Heat adequately refrigerated leftover food before use.