In an ideal inviscid, incompressible flow, we have, by conservation of energy,
where
This basic energy conservation law was published in 1738 by Daniel Bernoulli in his classic work Hydrodynamica.
From §B.7.3, we have that the pressure of a gas is proportional to the average kinetic energy of the molecules making up the gas. Therefore, when a gas flows at a constant height , some of its ``pressure kinetic energy'' must be given to the kinetic energy of the flow as a whole. If the mean height of the flow changes, then kinetic energy trades with potential energy as well.