$E=P+K$ is just a mathematical identity.
You just define a function $P(x)$ such that $-\frac{dP}{dx}=m\frac{d^2x}{dt^2}$, where $x$ is a function of $t$.
Now you multiply both sides by $dx$:
$$-{dP}=m\frac{d(\frac{dx}{dt})}{dt}dx$$
Now you just re-name $\frac{dx}{dt}$ as another function $v$, and integrate both sides to get:
$$-(P_2-P_1)=\frac{1}{2}mv_2^2-\frac{1}{2}mv_1^2$$
Or
$$P_2+\frac{1}{2}mv_2^2=P_1+\frac{1}{2}mv_1^2$$
Since this sum $P+K$ remains unchanged as you transition from state $1$ to state $2$, this $P+K$ is an important quantity named $E$.
The above is a mathematical fact and would work for abstract mathematical functions having nothing to do with the real world.
What makes it interesting in the real world is that nothing is saying that a $P(x)$ would exist with the property $-\frac{dP}{dx}=m\frac{d^2x}{dt^2}$, where $x$ represents the position function of particles. Mathematics doesn't guarantee the existence of $P(x)$. The fact that a potential function $P(x)$ exists for all fundamental forces makes energy interesting.