Petrol (or gasoline) is a fraction of crude oil. Crude oil is separated using fractional distillation Gasoline is a fairly light component of oil and is distilled at around 70oC. The carbon chains in fuel hydrocarbons have from 7 to 11 carbons. The major constituent of gasoline is octane with 8 carbons. 

This is a molecule of octane - to zoom in press shift and move the mouse around. (you will need the Chime plug-in to view this picture).

The combustion of octane is the driving reaction within the internal combustion engine. The combustion of octane is

C8H18 + 16O2 ------> 8CO2 + 16H2O 

The amount of octane in the fuel mix can affect the properties of the fuel such as the likelihood of Pre-ignition.

Pre-ignition: is the ignition of fuel, within the cylinder, which occurs independently of the spark plug. This can be caused by a hot spot in the chamber or a very high compression ratio. Pre-ignition causes an interruption in the piston's movement causing an affect known as knocking. Knocking can damage the engine.

Octane Number: the octane number expresses the antiknock properties of a fuel. The higher the amount of isooctane the less likely knocking is to occur. The octane number gives an indication of the isooctane:heptane ratio of the fuel. Isooctane has a knock rating of 100 and heptane has an knock rating of 0. A typical gasoline may have an octane number of 92 and therefore has the same knock as a mixture of 92% isooctane and 8% heptane. 

Fuel Additives: can increase the antiknock properties of a fuel. Tetraethyl lead is one such additive. Today most countries have banned the sale of leaded fuels and alternative additives are being used. A common additive is methyl tertiary butyl ether (MTBE) - C5H12O, this boosts octane number and is an oxygenate (add oxygen to the combustion mixture making it burn more efficiently). MTBE is thought to be carcinogenic at high levels. Follow this link for further information.  

Diesel: It is interesting that in a diesel engine pre-ignition is required, fuels with lower octane numbers are used and the engines are built to withstand higher forces than Otto engines, this is why Diesel cars tend to be noisier and heavier.