The potential energy, also called potential energy, of a body results from its motion in the Earth's gravitational field.
If a body is lifted from a height $h_1$ to a height $h_2$, work must be done for this process.
This work is then available as potential energy and can be defined using $E = \vec{F}\times\vec{s}$ as follows:
\begin{equation}
E_{\mathrm{pot}} = -\int_{s_1}^{s_2} \vec{F}\cdot\mathrm{d}\vec{s} = \int_{s_1}^{s_2} F\cos\theta\,\mathrm{d}s
\end{equation}
We can see the relationship between the infinitesimal height difference $\mathrm{d}h$ and the distance $\mathrm{d}s$ as $\mathrm{d}s~=~\mathrm{d}h/\cos\theta$. Substituting and integrating then yields the formula for potential energy:
\begin{equation}
{E_{\mathrm{pot}} = mgh}
\end{equation}
It is noteworthy that it depends only on the mass of the body (more precisely: the force of gravity) and the height difference $h = h_2 - h_1$. This form of energy is therefore also called potential energy.
The exact path by which the body was transported to this height is completely ignored, i.e., only $h$ plays a role.