The USDA has this to say on it:
One of the most common causes of foodborne illness is improper cooling of cooked foods. Because bacteria are everywhere, even after food is cooked to a safe internal temperature, they can be reintroduced to the food and then reproduce. For this reason leftovers must be put in shallow containers for quick cooling and refrigerated within 2 hours.
You'll find similar statements from government agencies around the world. The safe limit for raw or cooked food is 2 hours in the danger zone (40-140° F or 4.4-60° C).
If you're a restaurant owner or cook, you must follow this rule, hold hot foods above 60° C and quick-cool other foods before refrigerating. If you are not working in a professional capacity then you are not legally required to follow it, but if you are serving guests then it would be irresponsible (and possibly actionable, if someone gets sick) to do otherwise.
If you're an individual serving only yourself, then take whatever liberties and break whatever rules you want; it's your food, and your body. But there's no table or chart anyone can give you; there's no single specific point at which a food transitions from "not entirely safe" to "probably will kill you" because it depends entirely on the food, the environment, your immune system, and a plethora of other variables. The rule is 2 hours, period ; any longer and there is some non-trivial
risk to your health.
Some hints, tips, and warnings:
The 2-hour rule is a conservative estimate with a safety margin. Don't ask what that margin is. It's like asking what the "real" speed limit is on a posted road; you might know from experience, but it could change depending on circumstances and exceeding it by any amount means you take your chances and accept the risks.
Don't put large, hot items (such as an entire pot of soup or chili) directly into the fridge. The residual heat will warm up and potentially spoil other items in the refrigerator.
To quickly cool large cooked items, use an ice-water bath and/or divide them into small containers. (Note: Don't use an ice-water bath for cast iron.)
Don't assume that re-cooking an improperly-stored item will make it safe. Most bacteria produce protein toxins, which are actually the primary agents responsible for food poisoning, and several of these toxins are heat-resistant. Cooking will not kill or inactivate these toxins and eating the re-cooked food will still make you sick.
Don't assume that cooking "kills everything" and that a cooked food or cooking surface is absolutely sterile. Cooking kills enough to make the food safe to eat, but some organisms - such as bacterial spores from bacillus and clostridium - can survive the cooking process and immediately start producing more bacteria. Sous-vide bags, crock pots, etc. are not safe environments for cooked food in the temperature danger zone.