Most modern engines use some type of fuel injection to deliver fuel to the cylinders. The ECU determines the amount of fuel to inject based on a number of sensor readings. Oxygen sensors tell the ECU whether the engine is running rich (too much fuel/too little oxygen) or running lean (too much oxygen/too little fuel) as compared to ideal conditions (known as stoichiometric). The throttle position sensors tell the ECU how far the throttle plate is opened when you press the accelerator. The mass air flow sensor measures the amount of air flowing into the engine through the throttle plate. The engine coolant temperature sensor measures whether the engine is warmed up or cool. (If the engine is still cool, additional fuel will be injected.)
Air/fuel mixture control of carburetors with computers is designed with a similar principle, but a mixture control solenoid or stopper motor is incorporated in the float bowl of the carburetor.