Without getting into complicated chemistry, molecular bonding and hydrocarbon chains, octane is simply a measure of a fuels resistance to detonation. The higher the number, the less prone the fuel is to detonation and pre-ignition.

Green Beaker

Detonation is the un-uniform ignition of the air/fuel charge in the combustion chamber. Normally, the combustion flame front originates from the spark center. When detonation occurs, the charge is lit at not only the spark center, but also from hot spots within the combustion chamber. This causes an uneven flame front, resulting in a sudden rise in combustion pressures, which can damage a piston on the power stroke.

A more catastrophic scenario, called pre-ignition, occurs when the charge unintentionally lights off without a spark. This usually means the event occurs toward the end of the compression stroke when charge temperatures and pressures are still rising. With pre-ignition, the sudden change in charge pressure from premature ignition as the piston is still moving up is equivalent to taking a hammer and beating it on top of your pistons. The sound is very similar, just like a ping.

Higher octane fuels are especially helpful to boosted or high-compression performance engines, along with older engines. With boost or a high-compression ratio, the air-fuel charge is compressed to higher pressures, which makes it more susceptible to detonation. Older engines with carbon deposits built up in the combustion chamber also benefit from high-octane fuels as the added space occupied by the deposits also effectively increases the compression ratio.

To avoid detonation, engines with knock sensors retard the spark timing at the onset of knock/detonation/ping. Retarding spark timing or enriching the air/fuel mixture to reduce knock ultimately robs power. This is why an increase in octane increases horsepower. Since the engine's knock threshold is effectively raised with higher octane fuels, spark timing is not retarded. This allows combustion and charge expansion to occur so that more force is put into the power stroke.

Fuel Octane is measured in RON (Research Octane Number) which is the number you see on the petrol pump at the filling station (eg. 95).