The work-energy theorem is the relationship between the work and the energy. The work we do can be converted to energy and in this case we see a special case in which the work is converted to kinetic energy called work-kinetic energy theorem.
We consider that a body moves through a displacement \(\vec s\) along positive x-direction under the action of a constant net force \(\vec F\). Also note that \({v_{ix}}\) is the initial velocity and \({v_{fx}}\) is the final velocity of the body. Newton's second law gives,
\[{F} = m{a_x}\]
We have \({v_{fx}}^2 = {v_{ix}}^2 + 2{a_x}s{\rm{ }}\). Therefore, putting the value of \(a_x\) from \({v_{fx}}^2 = {v_{ix}}^2 + 2{a_x}s{\rm{ }}\) in the above equation, we get,
\[\begin{align*} F &= m\left( {\frac{{{v_{fx}}^2 - {v_{ix}}^2}}{{2s}}} \right)\\ {\rm{or,}}\quad Fs &= \frac{1}{2}m{v_{fx}}^2 - \frac{1}{2}m{v_{ix}}^2\\ {\rm{or,}}\quad W &= \frac{1}{2}m{v_{fx}}^2 - \frac{1}{2}m{v_{ix}}^2 \tag{2} \label{2} \end{align*}\]
In Equation \eqref{2} the quantity \(\frac{1}{2}m{v^2}\) which is the half of the product of mass and velocity squared is called kinetic energy of the body. It means the kinetic energy of a moving body with velocity \(v\) at any instant of time is \(\frac{1}{2}m{v}^2\). So, \(\frac{1}{2}m{v_{ix}}^2\) is the initial kinetic energy and \(\frac{1}{2}m{v_{fx}}^2\) is the final kinetic energy. Therefore, \({K_1} = \frac{1}{2}m{v_{ix}}^2\) and \({K_2} = \frac{1}{2}m{v_{fx}}^2\), therefore
\[W = {K_2} - {K_1} = \Delta K \tag{3} \label{3}\]
The Equation \eqref{3} is also called work-energy theorem and in this case the work is equal to the change in kinetic energy, so we call it work-kinetic energy theorem. You can conclude from Equation \eqref{3} that the work done by a net force on a body is equal to the change in kinetic energy of the body.
The above derivation of work done as the change in kinetic energy is based on a constant force applied but the work-energy theorem given by Equation \eqref{3} or Equation \eqref{2} is true even if the force is not constant or the motion is not always along a straight line. Let's provide some light to this by considering a motion along straight line with changing force.
In that case you need to divide the displacement into infinitesimally small segments such as \(dx\) so that the varying force is constant over the small segment of the displacement, and you integrate to find the total work done. So, if \(F_x\) is the varying force, in positive x-direction and the body moves from position \(x_1\) to \(x_2\), the total work is
\[W = \int_{x_1}^{x_2} F_xdx \]
You know that \(a_x = dv_x/dt = (dv_x/dx)dx/dt = v_xdv_x/dx\) and you can finally get from solving
\[W = m\int_{v_1}^{v_2} v_xdv_x = \frac{1}{2}mv_2^2 - \frac{1}{2}mv_1^2\]
which is the same expression as we determined for the constant force case. Because it contains the term \(v^2\) which is always positive and does not depend on the direction of motion, and therefore work-kinetic energy theorem depends on the change in speed not the change in velocity. If the body begins to move \(v_1 = 0\) and stops \(v_2 = 0\), the net work done is zero. If the body is already in motion at \(v_1\) and reaches \(v_2\) after some time, the net work done is the difference between final kinetic energy and initial kinetic energy.
Fortunately the work energy theorem is the same for both varying and non varying forces. Let's look at the situation when the path is not a straight line and the force still varies.
For example, a varying force \(\vec F\) is being applied on a body along a curved path and in that case we resolve the force into its components parallel and perpendicular to the displacement. And we only take the parallel component along the whole path (the path is again divided into infinitesimal segments). The perpendicular component of the force does no work and you end up with a similar situation as we just derived.