It's pretty easy to avoid eating spoiled food. If the funky smell doesn't warn you off, the weird color probably will.
Harmful bacteria such as salmonella and E. coli are a different story, though. When these organisms, known as pathogens, contaminate our food, they do so without producing any physical signs, smells, or tastes whatsoever. Since we can't use our senses to determine whether something is safe to eat, we need to rely on other methods to avoid getting sick.
Fortunately, we have size on our side. Bacteria are really small, and it takes quite a lot of them to make us sick.
The problem is that they can reproduce with astonishing speed. E. coli, for instance, reproduce every 20 minutes. Which means that a single E. coli cell can produce more than 16 million copies of itself in just 8 hours. But only under certain conditions, one of which is temperature.
The temperature most conducive to bacterial reproduction is between 41 F and 140 F, a region known as the "Temperature Danger Zone."
Thus, one of the simplest ways to prevent food poisoning is by keeping your food either colder than 41 F or hotter than 140 F. (And note that temperature is only one of the factors related to bacterial growth. There are six of them.)
Technique #1: Heat It up
It so happens that the very best way to neutralize foodborne pathogens is to kill the little buggers. After all, dead bacteria can't reproduce. And it's really not that hard to do. Temperatures hotter than 165 F kill most bacteria within a few seconds.
In other words, cooking. Have you ever noticed that the foods associated with many of the high-profile outbreaks of foodborne illness tend to be things like sprouts, or bagged greens, or guacamole? What these foods have in common is that they're not cooked before serving. That's what makes them so potentially dangerous.
Depending on the food, you might only need to heat its exterior to 165 F. Like a steak, for instance. A steak is a solid slab of muscle, and since bacteria don't burrow, you only need to ensure that the surface gets hot, while the interior remains a lovely medium-rare.
Burgers are a different story. Grinding meat takes any bacteria that might be on its surface and swirls it all throughout the ground meat. Thus, a hamburger's internal temperature has to reach 165 F, not just the outside.
Technique #2: Cool It Down
At the other end of the temperature spectrum, we're talking about storing our food either in the refrigerator or the freezer. Normal refrigerator temperature is 40 F or colder, and at that temperature, foodborne bacteria significantly slow down their reproductive cycle. And in the freezer, it slows to nearly zero. Note that freezing alone doesn't kill bacteria. But it sends them into a kind of hibernation. Once the food thaws, they wake up again, and you need to use technique #1 above.
To substantially reduce your chances of contracting, or passing along, a food-borne illness, make sure that your perishable foods never spend more than two hours in the Temperature Danger Zone.
In short, you want to keep cold foods cold and keep hot foods hot.