In automobiles, this phenomenon is also known as "engine knock" or "abnormal combustion." In a perfectly functioning engine, the spark plug ultimately determines when to ignite a cylinder, creating a controlled explosion. In a detonating engine, the fuel/air mixture ignites (due to high pressure and heat) before the spark plug would otherwise do so, creating multiple flame fronts within the cylinder. These flame fronts often collide with eachother or the piston, and the resulting uncontrolled reaction leads to losses in power and fuel efficiency. Detonation is one of the leading causes of engine damage.
It is often called "knock" because many forms of detonation are accompanied by a knocking or pinging noise (which, as drinkypoo pointed out in a /MSG, is the sound of the piston itself wobbling against the cylinder wall). This noise is the result of a relatively "late" detonation. If detonation occurs early enough in the combustion cycle, no sound will be heard, and the engine may be damaged without providing any indication to the owner. Silent detonation can sometimes be worse than knock, as if it occurs early enough, the piston is forced to move upwards against a wave of compressed, exploding gas. This "unnatural" action ("preignition") can actually bend the connecting rods within the engine. There are several causes of detonation, most of which involve increased compression, increased temperature, or a leaner fuel/air mixture:
Bad gas. In general, higher-octane fuel burns more controllably, and is less likely to explode before the spark ignites it. It is for this reason that "racing fuel" means 100 octane or better. In most areas, the best available gas is 91 or 93 octane, although octane booster can be added.
- Advanced ignition timing. Ignition timing is preset by the manufacturer, and is chosen in part based on the manufacturer's fuel quality recommendations. This is why it's a bad idea to put 85 octane fuel in a 2001 Z06 Corvette. The engine has been designed with a high compression ratio and rather advanced timing, so dumping a poor-burning fuel in it is a bad idea. It's pretty difficult to advance ignition timing on a car with a distributorless ignition, as it is computer controlled. One popular "mod" with performance-enthusiasts is to advance the ignition timing just enough to where the car won't knock (at any point from idle to redline), but has increased performance. The trade-off? You must use fuel with an octane rating equal to or greater than the fuel you used when you set the timing, for the rest of the car's life, or until you retard the timing again (which isn't a good idea).
- Carbon deposits. Carbon deposits can accumulate on the piston or in the combustion chamber. This black coal-like substance will retain enormous amounts of heat, reaching temperatures high enough to initiate combustion before the spark would otherwise do so. There are various ways to deal with this, including chemical treatments that don't require dismantling the engine.
- "Hot spots" within the engine block or on the piston itself. Because engines are mass-produced, they are always going to have imperfections within as a result of their die-cut nature. Roughly cut edges on a piston or in a combustion chamber can reach temperatures high enough to spontaneously ignite.
Detonation is more of a problem with people who tune
their cars, as most new cars are designed with rigid specifications and sensors intentionally designed to prevent it. As soon as one decides to mess around with their car's performance, they must consider the effects of detonation. The most effective way to increase a car's power output is to use forced induction. The three most popular (are there any other forms?) forms of forced induction are the turbocharger, the supercharger, and nitrous oxide. All three methods increase the amount of air (and pressure) in the combustion chamber, so something must be done to increase the amount of fuel as well. In other words, it's a bad idea to slap on a turbo without doing anything to your fuel system.
A car's compression ratio is an important factor when dealing with detonation. The higher the ratio, the more likely detonation is to occur (given other undesirable variables), and the more likely it is to do some serious damage to your engine when it does occur. A higher compression ratio requires higher octane fuel, and generally results in better fuel economy. It's usually a bad idea to add forced induction to a car that already has a very good compression ratio, unless something is done to lower it first. A popular modification is to simply install two gaskets between the cylinder head and engine block. This small increase in volume can lower a compression ratio by as much as half a point in many cases.
It is for these reasons that most serious enthusiasts will never add a turbo/supercharger without lowering their compression ratio and adding an intercooler, which cools the charged air dramatically before it's forced into the combustion chamber. Also, ignition timing is generally retarded when using such equipment. Many tuners have aftermarket ignition systems installed, allowing them to control their timing during a drag race, which is especially important when using nitrous oxide (as it often provides too much initial power to get good traction). A common practice is to advance the timing for at least the first thirty feet of the race. Once the driver has sufficient traction, he/she will simultaneously retard the timing and kick in the nitrous oxide, which rapidly increases the power output of the engine while also minimizing the potential for detonation. Some aftermarket manufacturers have come out with systems that change the ignition timing on the fly, depending on the amount of boost going into the engine, providing true best-of-both-worlds results.