The most transparent way to determine the expressions for energy, momentum and angular momentum of a certain (mechanical) system (described by its action integral $S$) is to study its behaviour under time translations, spatial translations and spatial rotations. If the system is time-translation invariant, the Noether theorem tells us that there exists a conserved quantity being defined as the energy $E$ of the system (up to some factor). If the system is invariant under translations in all three spatial directions, the corresponding three independent conserved quantities are defined as the three component of the momentum vector $\vec{p}$ of the system. If the system is invariant under rotations around a certain axis (say, the $z$-axis) the corresponding constant of motion is defined as the $z$-component $L_z$ of the angular momentum vector.
The general form of the action integral of a system with $f$ degrees of freedom with generalized coordinates $q_1, \ldots q_f$ has the form $$S=\int\limits_{t_1}^{t_2} \! dt \, L(q_1, \ldots, q_f, \dot{q}_1, \ldots, \dot{q}_f,t), \tag{1} \label{eq1}$$ where $L(q,\dot{q},t)$ is the Lagrangian function, characterizing the system under investigation. The equations of motion (Euler-Lagrange equations) $$ \frac{d}{dt} \frac{\partial L}{\partial \dot{q}_i} = \frac{\partial L}{\partial q_i}, \quad i=1,\ldots f \tag{2} \label{eq2},$$ derived from the requirement that the action integral \eqref{eq1} of the system attains an extremum (usually a minimum) for the actual motion of the system between the fixed initial and final points $q_i(t_1)$, $q_i(t_2)$ for $i=1,\ldots f$.
Time-translation invariance of a system ist reflected by the fact that in this case the Lagrangian function $L$ does not depend (explicitly) on the time variable $t$, i.e. $L=L(q,\dot{q})$. As a consequence, the expression $$ E:=\sum\limits_{i=1}^f \dot{q}_i \frac{\partial L}{\partial \dot{q}_i} -L \tag{3} \label{eq3}$$ is a constant of motion, as can easily be seen by computing the time derivative of $E$, $$ \frac{dE}{dt}=\frac{d}{dt}\left(\sum\limits_{i=1}^f \dot{q}_i \frac{\partial L}{\partial \dot{q}_i}-L \right)= \sum\limits_{i=1}^f \left( \ddot{q}_i\frac{\partial L}{\partial \dot{q}_i} +\dot{q}_i \frac{d}{dt} \frac{\partial L}{\partial \dot{q}_i} -\frac{\partial L}{\partial q_i} \dot{q}_i -\frac{\partial L}{\partial \dot{q}_i} \ddot{q}_i \right)=0,$$ where the equations of motion \eqref{eq2} were used to arrive at the final result. The quantity $E$ defined in \eqref{eq3} is refered to as the energy of the (time-translation invariant) system under investigation.
In the case, where $L$ happens to be independent of one of the coordinates (say $q_k$), we have $\partial L /\partial q_k=0$ and \eqref{eq2} for $i=k$ implies $$\frac{d}{dt} \frac{\partial L}{\partial \dot{q}_k} =0,$$ such that the (generalized) momentum $$p_k:= \frac{\partial L}{\partial \dot{q}_i} \tag{4} \label{eq4}$$ is a constant of motion.
As an illustration, let us apply this general formalism to a free, nonrelativistic particle with mass $m$ in an inertial frame. Choosing cartesian coordinates $x,y,z$, the form of the corresponding Lagrangian function $$L=m (\dot{x}^2+\dot{y}^2+ \dot{z}^2)/2 = m \vec{v}^2/2 \tag{5} \label{eq5} $$ is dictated by homogeneity of time ($L$ has no explicit time dependence) and space ($L$ is independent of the coordinates $x,y,z$) and isotropy of space ($L$ depends only on $|\vec{v}|$) in an inertial frame together with the requirement of Galilei invariance. Employing our general cooking recipe, the momenta are given by $$ p_x= \frac{\partial L}{\partial \dot{x}}= m\dot{x}, \quad p_y= \frac{\partial L}{\partial \dot{y}}=m \dot{y}, \quad p_z= \frac{\partial L}{\partial \dot{z}} = m\dot{z} \tag{6} \label{eq6}$$ and the energy becomes $$ E= \dot{x} p_x + \dot{y} p_y + \dot{z} p_z-L = m \vec{v}^2/2. \tag{7} \label{eq7} $$
In the relativistic case, the Lagrangian function of a free particle with mass $m$ (in an inertial frame) takes the form $$L= -mc^2 \sqrt{1- \vec{v}^2/c^2}\tag{8} \label{eq8} $$ ensuring the Lorentz invariance of the action integral (remember that $c^2 dt^2 - d\vec{x}^2$ is Lorentz invariant). The prefactor $-mc^2$ in \eqref{eq8} is required by consistency with the nonrelativistic Lagrangian function \eqref{eq7} in the nonrelativistic limit $|\vec{v}| \lt \! \lt c$ as $-mc^2 \sqrt{1-\vec{v}^2/c^2} \to -mc^2 +m \vec{v}^2/2+ \ldots$ (the additional constant term $-mc^2$ does not affect the equations of motion). The further steps are now straightforward. Applying the general formalism, one finds $$\vec{p} = \frac{m \vec{v}}{\sqrt{1-\vec{v}^2/c^2}}, \quad E=\frac{mc^2}{\sqrt{1-\vec{v}^2/c^2}} \tag{9} \label{eq9}$$ for the relativistic momentum vector and the relativistic energy. Expressing $E$ in terms of $\vec{p}$, we obtain the relativistic energy-momentum relation $$E=c\sqrt{m^2 c^2 + \vec{p}^2 } \tag{10} \label{eq10}. $$ Note that \eqref{eq10} is also applicable for massless particles (like the photon), where $E= c |\vec{p}|$.
The methods desribed here can also be generalized to systems with an infinite number of degrees of freedom (in particular fields). As an example, in electrodynamics one finds expressions $\sim \vec{E}^2+ \vec{B}^2$ for the energy density and $\sim \vec{E} \times \vec{B}$ for the momentum density of the electromagnetic field.