What is octane?
If you've read How Car Engines Work, you know that almost all cars use four-stroke gasoline engines. One of the strokes is the compression stroke, where the engine compresses a cylinder-full of air and gas into a much smaller volume before igniting it with a spark plug. The amount of compression is called the compression ratio of the engine. A typical engine might have a compression ratio of 8-to-1. (See How Car Engines Work for details.)
The octane rating of gasoline tells you how much the fuel can be compressed before it spontaneously ignites. When gas ignites by compression rather than because of the spark from the spark plug, it causes knocking in the engine. Knocking can damage an engine, so it is not something you want to have happening. Lower-octane gas (like "regular" 87-octane gasoline) can handle the least amount of compression before igniting.
The compression ratio of your engine determines the octane rating of the gas you must use in the car. One way to increase the horsepower of an engine of a given displacement is to increase its compression ratio. So a "high-performance engine" has a higher compression ratio and requires higher-octane fuel. The advantage of a high compression ratio is that it gives your engine a higher horsepower rating for a given engine weight -- that is what makes the engine "high performance." The disadvantage is that the gasoline for your engine costs more.
The name "octane" comes from the following fact: When you take crude oil and "crack" it in a refinery, you end up getting hydrocarbon chains of different lengths. These different chain lengths can then be separated from each other and blended to form different fuels. For example, methane, propane and butane are all hydrocarbons. Methane has a single carbon atom. Propane has three carbon atoms chained together. Butane has four carbon atoms chained together. Pentane has five, hexane has six, heptane has seven and octane has eight carbons chained together.
It turns out that heptane handles compression very poorly. Compress it just a little and it ignites spontaneously. Octane handles compression very well -- you can compress it a lot and nothing happens. Eighty-seven-octane gasoline is gasoline that contains 87-percent octane and 13-percent heptane (or some other combination of fuels that has the same performance of the 87/13 combination of octane/heptane). It spontaneously ignites at a given compression level, and can only be used in engines that do not exceed that compression ratio.