Usually in mechanical pumps ; a timing device changes the way the fuel is injected. Please give a read to the following document from bosch to have a good overview how it's done.
There is a - usually hydraulicly actuated - 'injection (advance) timing device doing the 'trick'. The intrinsic firing delay is compensated (at higher rpms) by injecting 'earlier' (in terms of injection start angle).
Thus, in'time' the injections always starts at the same point in time with respect to top dead center.