assume two mass collied
the conservation of the linear momentum is the conservation of the center of mass velocity bevor and after the collision , no external forces are applied.
the equation
$$\frac{m_1\,v_1+m_2\,v_2}{M}=\frac{m_1\,u_1+m_2\,u_2}{M}\quad\Rightarrow\\
m_1(v_1-u_1)+m_2(v_2-u_2)=0\quad \text{conserved !}$$
the total energy is
$$2\,T=m_1\,(v_1^2-u_1^2)+m_2\,(v_2^2-u_2^2)=
m_1\,(v_1+u_1)\,(v_1-u_1)+m_2\,(v_2+u_2)\,(v_2-u_2)$$
and with the momentum conservation you obtain
$$2\,T=m_2\,(v_2-u_2)\,\underbrace{(v_2-v_1+(u_2-u_1))}_{=0}$$
thus the total energy is also conserved
in case of elastic collision
$$2\,T=m_2\,(v_2-u_2)\,\underbrace{(v_2-v_1+\epsilon\,(u_2-u_1))}_{\ne 0}$$
where $~\epsilon~,(0\le \epsilon\le 1) ~$ is per definition
$$\epsilon=-\frac{v_2-v1}{u_2-u1}$$
so only for inelastic case $~\epsilon=1~$ the total energy is conserved
- $~u_i~$ velocities bevor the collision
- $~v_i~$ velocities after the collision