Ignition Advance
I can't remember where most of this came from.
Under normal circumstances, when the fuel-air mixture in the engine burns, it does so in a controlled manner, releasing the energy that produces the force that drives the pistons. Now, if you think about it, it might seem that the correct time for the spark plug to ignite the mix would be when the piston reaches the top of its stroke. Then, as the mix burns and energy is released, the energy pushes the piston down. The problem is that it takes a certain amount of time for the mix to burn. If you wait until the top of the stroke to ignite it, the bulk of the energy will be applied to the piston only during the latter part of its downward movement.
In order to get the maximum use out of the combustion energy, the mix is ignited while the piston is still moving up. This is called "advance". As the engine speed increases, fuel has less time to burn and advance is increased accordingly. Ignition advance is controlled by the engine management computer. It varies in response to a host of other conditions but the base advance curve is a function of engine speed.
Now we have a new problem. As the mix is ignited earlier, it is not compressed as much and has a tendency to burn at an uncontrolled extremely high rate (it basically explodes). This is called "detonation". When this happens, all the energy in the fuel is released almost instantly. The resulting shock wave slams into the piston which is forced through it by the inertia of the engine and the combustion in other cylinders . The resulting stress on the engine is enormous.
Detonation can be caused by several things not just a lean condition or bad choice of fuel octane: Too much compression and too much timing can also be to blame.