There are typically two pumps in the fuel system. There is a low pressure pump that pulls fuel from the tank and thru the filters and delivers it to the high pressure injection pump. Then the high pressure injection pump forces the fuel at 2000-3000psi to the fuel injectors with the correct timing to be burnt in the cylinders. One would think that with all that pressure any air would be forced completely through the system.
But the injectors in cylinders are a spring-loaded valve that don't open until the fuel reaches a "pop-off" pressure. That pressure is less than the maximum pressure of the injection pump, but is well over 1000psi. These two devices- the injection pump and the injectors are calibrated and timed to allow fuel into the cylinders at the right time and deliver the right amount. As long as the fuel lines are completely filled with fuel, everything works as designed. The key point is that the diesel fuel cannot compress so the injection pump can push the fuel through the injectors. However if there is air in the lines, when the injection pump pushes the diesel, the air between the fuel and the injector simply compresses because the air is a gas. It is just like a air-shock absorber. So the fuel never gets to the injector and the injector never opens because it never sees the full injector pump pressure. Bottom line is that the fuel never gets to the cylinder, nor does the air get expelled from the fuel lines.
So when you crack open an injection line at the injector, you allow the air in the lines to be pushed out leaving only diesel fuel in the line. Now the injection pump can push the diesel through the injector and the engine receives fuel.