Motivation of relativistic energy
Consider a completely inelastic collision. In lab frame, particle $A$ travels at speed $u$ to the right towards a stationary particle $B$ each with mass $m$. After the collision, the particle has mass $M$ has travels to the right at speed $v$.
Using conservation of momentum, $$\begin{align*} \gamma_u mu &= \gamma_v Mv \\ M &= \frac{\gamma_u}{\gamma_v}\frac{u}{v}m \tag{1}. \end{align*}$$
In the zero-momentum frame, the final momentum is 0, so the frame is moving at speed $v$ to the right relative to the lab. Therefore before the collision, particle B moves at speed $v$ to the left in this frame. Since initial momentum is 0, particle A moves to the right at speed $v$.
Using the velocity addition formula, the speed of particle A in lab frame satisfies $$ u = \frac{v+v}{1+\frac{v^2}{c^2}} = \frac{2v}{1+v^2/c^2}. \tag{2} $$
Before we substitute into (1), let's compute using (2) $$\begin{align*} \gamma_u &= 1/\sqrt{1-\frac{4v^2/c^2}{(1+v^2/c^2)}} \\ &= 1/\sqrt{\frac{1+2v^2/c^2+v^4/c^4 - 4v^2/c^2}{1+2v^2/c^2 + v^4/c^4}} \\ &= 1/\sqrt{\frac{1-2v^2/c^2+v^4/c^4}{1+2v^2/c^2 + v^4/c^4}} \\ &= 1/\sqrt{\frac{(1-v^2/c^2)^2}{(1+v^2/c^2)^2}} \\ &= \frac{1+v^2/c^2}{1-v^2/c^2}. \end{align*}$$ Substituting (2) into (1), $$\begin{align*} M &= \sqrt{1-v^2/c^2}\frac{1+v^2/c^2}{1-v^2/c^2} \frac{2v}{v(1+v^2/c^2)} m \\ &= \frac{2m}{\sqrt{1-v^2/c^2}} = \gamma_v(2m). \end{align*}$$
We check that in the limit $v\ll c$, $$\begin{align*} M &= 2m\Big(1-\frac{v^2}{c^2}\Big)^{-1/2} \\ &\approx 2m+\frac12(2m)\frac{v^2}{c^2} \\ Mc^2 &= 2mc^2 + \frac12(2m)v^2 = 2mc^2 + K. \end{align*}$$ This suggests that kinetic energy does not conserve, but "total energy" does.