As others have said, this will depend on what has caused the food to spoil. I would add however, that there is a third route that has not been mentioned - spores. Spores are basically kind of the bacterial equivalent of a space suit - bacteria can form spores when conditions are bad and as spores can often survive extremely hostile conditions, including heat, acid, bleach, etc. Spores are especially important in the case of botulism.
If the food has spoiled due to botulism, there is not much you can do to make sure it is safe. You may be able to kill the bacteria and destroy toxin directly in the food by prolonged heating (at least according to the USDA fact sheet below), but even so the spores of the bacteria are heat resistant. If you consume the spores, they can activate and become live bacteria which will then produce the toxin directly in your body, and it is the toxin which can cause serious or fatal damage.
For a good summary of botulism and botulinum toxin, see: http://www.fsis.usda.gov/factsheets/Clostridium_botulinum/index.asp