What is the underlying principle of the difference between potential energy and other energy types? The kinetic energy of a body's motion is given by the equation 
$$ E_{kin} = \frac{1}{2}m v^2, $$
where $m$ is the body's mass and $v$ its velocity. If I consider rotations, it is
$$ E_{kin} = \frac{1}{2}J \omega^2, $$
where $J$ is its moment of inertia and $\omega$ its angular velocity. 
One can find the formula of the energy of a spring with constant $D$ and elongation $s$ with 
$$ E = \frac{1}{2}D s^2,$$
of a condensator with capacity $C$ charged with Voltage $U$
$$ E = \frac{1}{2}C U^2,$$
of a coil with inductivity $L$ with current $I$
$$ E = \frac{1}{2}L I^2$$
and maybe even more of that type. But the potential energy formula of a object with mass $m$ at height $h$ is given by $$E=mgh.$$
Why is it different? Is there a underlying principly?
 A: First of all - kinetic energy is very different kind of energy from the rest. The energy of the spring, capacity, inductivity and gravitation is given by the work forces are able to do on the object, but kinetic energy is energy that tells you how does this work influence the objects movement. 
Now the spring, capacity and inductivity energy is that way, because the forces are trying to restor the situation to its zero energy value. For example to store energy in the spring, you need to overcome forces that are trying to put the string back to s=0. The term you see is the first approximation to such force, given by Taylor expansion $F(x)=b*x+...$ (the constant term is zero, because we are doing expansion around point, that is "stable", in case of string that would be around its normal length, where the force vanishes).
The gravitational force of - in this case - Earth is different. There is no stability value, the force is constant everywhere (to the first approximation), so the resulting energy is different. 
If you would drill a hole into Earths center, then the force in the center also vanishes, and you could expand the force around it:
$$\vec{F}=-G\frac{M_R m}{r^3}\vec{r},$$
where $M_R$ is the mass under the radius $R$. For small $R$ you can approximate density  of Earths nucleus around the center ($\rho$) by constant so you get:
$$M_R=\frac{4\pi r^3}{3}\rho$$ and plugging this into force equation you get:
$$\vec{F}=-K\vec{r},$$
where $K$ is just some positive constant (the minus sign tells you that it is restoring force, which tries to push the object into $r=0$). This force is exactly in the form I mentioned for spring,capacitor etc. and it leads to energy in the form of:
$$E=\frac{K}{2}r^2$$
Note: I just tried to explain the main difference between the energies you mentioned and why squared term is so common. I did not try to explain the details of how it actually works. For example for capacity I suggested that the force is $F(U)=b*U,$ but this, strictly speaking, would not be really a force, but rather some kind of generalized force. 
A: Here is a  semi-handwaving answer.
Energy represents stored work which is in the case of a (linear) spring being stretched an integral of an effort (force) variable over the displacement through which the application point of the force has moved. This means it is the area under the curve of force on the y-axis and displacement on the x-axis. Because it is an area it is plausible to assert (wave hands here) it is always positive since negative areas do not exist, and when you actually do the integral in the example of a linear spring being stretched you get the 1/2 factor in front and the ^2 applied to the displacement variable. The (displacement)^2 ensures the energy will always be positive regardless of how we define the displacement sign.
Gravity is different than a spring because if we lift a small object up against gravity a small distance compared to the size of the large gravitating object, the force on the small object is constant - it does not increase in proportion to the distance through which we lifted it. If you integrate a force which is a constant with distance against distance, the constant force passes through the integral sign and neither the 1/2 factor nor the ^2 dependence appear in the equation. 
How to keep gravitational energy positive at all times? You uniquely define all heights as positive.  
A: The first thing to note is that almost all of the formulas you wrote are actually approximations. For example, the kinetic energy $E = \frac{1}{2}mv^{2}$ is actually an approximation to the relativistic formula $E = (\gamma - 1)mc^{2}$. The potential energy of a spring $E = \frac{1}{2}Ds^{2}$ is an approximation as well, because real life springs follow the ideal harmonic oscillator equations only to approximate degrees. A real spring deviates from the ideal formulas once you compress/expand it too far.
This gives us the first puzzle piece to the full picture of what is going on.
What we are looking at are not the fundamental formulas, but second-order Taylor approximations.
Consider any energy formula $E = E(x)$ as a function of variable $x$. For small enough $x$, we can take the lowest-order Taylor approximation about $x=0$.
If the lowest-order behavior is first-order, then our formula will reduce to a linear function. If the lowest-order behavior is second-order, then our formula will reduce to a quadratic term.
Clearly, most of the formulas in the OP are of the latter kind.
Since most potential energy formulas are of the latter kind, we'll consider the second-order Taylor approximation to $E = E(x)$:
$$ E(x) = c_{0} + c_{1}x + c_{2}x^{2} + c_{3}x^{3} + \cdots \approx c_{0} + c_{1}x + c_{2}x^{2}. $$
This reduces our formula to a quadratic polynomial. Now we have to explain why the formulas you wrote are directly proportional to the square of input variable.
I claim the following.

If your energy function $E(x) = c_{0} + c_{1}x + c_{2}x^{2}$ satisfies the two conditions below, then $c_{0} = c_{1} = 0$.

*

*The potential energy of the system with $x = 0$ is zero, i.e. $E(0) = 0$.

*The potential energy of the system is always nonnegative, i.e. $E(x) \ge 0$ for all $x$.


Suppose (1) and (2) hold.
The constant term $c_{0}$ must be zero, because condition (1) implies $E(0) = 0 = c_{0}$.
Then we are left with $E(x) = c_{1}x + c_{2}x^{2}$.
The only possible quadratics of this form that are nonnegative everywhere are those with $c_{1} = 0$.
If we take the derivative $E'(x) = c_{1} + 2c_{2}x$, then we see $E'(0) = c_{1}$.
If $E'(0)$ is negative, then the slope of $E(x)$ at $x=0$ is negative and then $E(x)$ would have to be negative for some arbitrarily small $x > 0$, contradicting (2).
If $E'(0)$ is positive, then the slope of $E(x)$ at $x=0$ is positive and then $E(x)$ would have to be negative for some arbitrarily small $x < 0$ ("small" as in "close to zero"), contradicting (2).
This proves
$$ E(x) = c_{2}x^{2}. $$

Indeed, when we look at the systems that your formulas describe, we find that all the scenarios (excluding the last one) satisfy conditions (1), (2). As I've shown, there's not much freedom for what kind of energy formula you can have at that point.
You wrote that the gravitational potential energy for an object of mass $m$ at height $h$ is $E = mgh$. However, even this formula is an approximation, because it assumes a uniform gravitational field.
For a uniform gravitational field, the height $h$ is relative.
If you set $h$ to be the distance between the object and, say, the sea level, there is no reason why it can't apply to below the sea level if you're in the appropriate place. If your object goes below your arbitrary $h=0$ level, the potential energy would keep decreasing and become more negative as the object gains more kinetic energy. Therefore, condition (2) is violated.
The formula $E = mgh$ is actually a first-order approximation (that is shifted by a constant) to the potential energy formula $E = -\frac{GmM}{r}$. This is exactly how all the other formulas are second-order approximations to the more complicated formulas.
