This article is from the Gasoline FAQ, by Bruce Hamilton with numerous contributions by others.
Engine management systems are now an important part of the strategy to
reduce automotive pollution. The good news for the consumer is their ability
to maintain the efficiency of gasoline combustion, thus improving fuel
economy. The bad news is their tendency to hinder tuning for power. A very
basic modern engine system could monitor and control:- mass air flow, fuel
flow, ignition timing, exhaust oxygen ( lambda oxygen sensor ), knock
( vibration sensor ), EGR, exhaust gas temperature, coolant temperature, and
intake air temperature. The knock sensor can be either a nonresonant type
installed in the engine block and capable of measuring a wide range of knock
vibrations ( 5-15 kHz ) with minimal change in frequency, or a resonant type
that has excellent signal-to-noise ratio between 1000 and 5000 rpm .
A modern engine management system can compensate for altitude, ambient air
temperature, and fuel octane. The management system will also control cold
start settings, and other operational parameters. There is a new requirement
that the engine management system also contain an on-board diagnostic
function that warns of malfunctions such as engine misfire, exhaust catalyst
failure, and evaporative emissions failure. The use of fuels with alcohols
such as methanol can confuse the engine management system as they generate
more hydrogen which can fool the oxygen sensor  .
The use of fuel of too low octane can actually result in both a loss of fuel
economy and power, as the management system may have to move the engine
settings to a less efficient part of the performance map. The system retards
the ignition timing until only trace knock is detected, as engine damage
from knock is of more consequence than power and fuel economy.