It is to do with energy losses due to friction with the pipe wall.
The total energy in a mass of moving fluid consists of height, velocity and pressure components. You can express the total energy, the sum of all 3 components, as head/height i.e., H total = h + v^2/2g + P/ρg according...