Getting the air/fuel mixture just right has always been a major challenge for engine designers and tuners alike, even with today's complex computer programs designed to constantly maintain the proper balance. The first method for adjusting the air/fuel ratio was the carburetor, which was adjusted manually by changing the size of the opening fuel could drip through on its way through the intake manifold. However, since this could only be adjusted by hand, it had to be constantly adjusted over time between trips/races to meet changing environment conditions.
Fuel injection was developed as a computer-controlled method to adjust how much fuel would be used. In order for the computer to know how much fuel is too lean or rich, there need to be sensors which detect whether the actions that the computer has taken have helped or hurt the mixture. These sensors are found on both the intake and exhaust so the computer knows how much air is going in, and the condition of the air coming out. For example, the oxygen sensors on the exhaust detect molecular oxygen, which is used combined with other elements in the combustion process. If more than just a trace amount is detected, that means the combustion is inefficient, and the computer allows the fuel injectors to spray more fuel into the mix, bringing it back to the efficient amount.
If the air/fuel mix is rich, that means too much fuel is finding its way into the combustion process. This is bad for horsepower, fuel efficency, and emissions.
If the air/fuel mix is lean, that means not enough fuel is being burned during the combustion process. A low level of fuel may sound good for fuel efficency, but it is bad for both power and emissions. Plus, it may mean fuel is leaving the combustion chamber unburned.
When the air/fuel mix is just right, it is considered a stoichiometric mix. This is usually considered 14.7:1 for gasoline engines, and is different for other fuels.
This mixture is the best for both power and emissions, and improves fuel efficency over a rich mixture. Hitting the target ratio perfectly is nearly impossible, but keeping it quite close isn't too difficult when all the intake and exhaust sensors are working properly.