When You Step on the Gas
The gas pedal in your car is connected to the throttle valve -- this is the valve that regulates how much air enters the engine. So the gas pedal is really the air pedal.
When you step on the gas pedal, the throttle valve opens up more, letting in more air. The engine control unit (ECU, the computer that controls all of the electronic components on your engine) "sees" the throttle valve open and increases the fuel rate in anticipation of more air entering the engine. It is important to increase the fuel rate as soon as the throttle valve opens; otherwise, when the gas pedal is first pressed, there may be a hesitation as some air reaches the cylinders without enough fuel in it.
Sensors monitor the mass of air entering the engine, as well as the amount of oxygen in the exhaust. The ECU uses this information to fine-tune the fuel delivery so that the air-to-fuel ratio is just right.