A sensor in the intake manifold (after the throttle) measures air temperature and manifold absolute pressure. From this information, the density of the incoming air is calculated. Knowing the RPM and displacement of the engine, the ECM calculates how much air the engine would pump at 100% Volumetric Efficiency (VE), considering the density calculated earlier. The VE is never exactly 100%, so it is corrected by stored values (percent efficiencies) in a VE look-up table. Now the amount of air in the cylinder is known and the ECM commands the fuel injector to spray just the right amount of fuel as indicated in the fuel table (Air/Fuel ratio).
It is critical that the VE table be correct for proper fueling, especially during periods when the bike is running open loop and not using the O2 sensors. Open loop happens pretty much any time you are accelerating. Steady-state cruise conditions will be closed loop.