Derivation of mean kinetic energy
A simple validation
The result you quoted is the average translational kinetic energy for an ideal gas.
First, let's sketch out a rough derivation for the average kinetic energy of a particles of an ideal gas using nothing more than high school physics.
The gas molecules just undergo translations, and don't rotate/vibrate. Also, they don't interact with each other.
Imagine a rectangular box which contains an ideal gas; the gas molecules have a speed $v_x$ in the $x$-direction. Since the box has a uniform cross-section of area $A$, a volume element spanned by a gas molecule in the box is $V'= |v_x\Delta t|A$. On average half the molecules move to the right, and half the molecules move to the left, since there is no preferred direction of motion. Thus, the number of molecules colliding with the container walls is
no. of molecules $= \frac{1}{2}.\frac{nN_a}{V}.|v_x\Delta t|A$
The momentum transferred per molecule is $2mv_x$, so the total momentum transferred is $ \Delta P = \frac{1}{2}.\frac{nN_a}{V}.|v_x\Delta t| 2mv_x$
Since force is rate of change of momentum, $F = \lim_{\Delta t \to 0} \frac{\Delta P}{\Delta t} = \frac{nMAv_x^2}{V}$
Pressure is force per unit area, so the average pressure is $P = \frac{nM \langle v_x^2\rangle}{V}$
Now, note that the total velocity is $v^2 = v_x^2+v_y^2+v_z^2$, and since there is no preferred direction of motion, one can assume all three components of velocity to be equal. $v_{rms}^2 = 3 \langle v_x^2\rangle$
Thus, $P = \frac{nMv_{rms}^2}{3V}$ also from the ideal gas equation $P = \frac{NkT}{V}$ we get $\frac{mv_{rms}^2}{3} = kT$
$E_{\text{kinetic}} = \frac{mv_{rms}^2}{2} = \frac{3kT}{2}$ Which is the result you wanted.
Using the Maxwell-Boltzmann Distribution
The same result for an translational kinetic energy can be arrived at using the Maxwell-Boltzmann distribution.
$$f(v) = 4 \pi \left( \frac{m}{2 \pi kT}\right)^{3/2} v^2 e^{\frac{-mv^2}{2kT}}$$
The average kinetic energy is $$\langle E_k \rangle= \langle \frac{mv^2}{2} \rangle = \int_{0}^{\infty}\frac{mv^2}{2} f(v)\mathrm{d}v = \frac{3kT}{2} $$
You can evaluate the integral as an exercise. I have omitted the details for the sake of brevity. It is relatively simple, you can either do it by hand, or look it up in a table or enter it into Mathematica
Now, the general statement of the theorem (using words and not math) us

For a system at equilibrium the average value of each quadratic cobtribution to energy is $\frac{kT}{2}$

An example of a quadratic contribution would be kinetic energy ($\frac{p^2}{2m}$) or the harmonic potential ($\frac{kx^2}{2}$)
A simple statistical mechanics approach
This theorem is strictly valid at &quot;high&quot; temperatures; we require that seperation between energy levels is small, and a lot of states are occupied so that they maybe treated as a continuum. This works well for translational and rotational modes of motion, but is not as reliable  for vibrational/electronic modes. Anyway, note that the analysis given below is under the framework of these assumptions.
note: $\beta = \frac{1}{kT}$
For a one dimensional container the translational partition function derived using particle in the box energy levels is given below
$$q^T = \frac{X}{\Lambda} \qquad \text{where} \ \Lambda = \frac{h \beta^{1/2}}{(2 \pi m)^{1/2}}$$
$$\langle E^T \rangle = -\frac{1}{q^T} \left( \frac{\partial q^T}{\partial \beta}\right)_V$$
again, you can evaluate this derivative as an exercise. (Hint: $\Lambda$ is constant multiplied by $\beta^{1/2}$). The result is given below
$$\langle E^T \rangle = \frac{kT}{2}$$
This is for translation in one direction (say X). The same process can be repeated for Y and Z, and thus for three dimensions
$$\langle E^T \rangle = \frac{3kT}{2}$$
Now let us examine rotations. Once again, I point out that this analysis is valid in the range $T &gt; \theta^R = \frac{hcB}{k} $
Here, B is the rotational constant.
In this range, an approximate expression for the partition function of a heteronuclear diatmic moeclue is $$q^R = \frac{1}{\beta hcB}$$
$$\langle E^R \rangle = -\frac{1}{q^R} \left( \frac{\partial q^R}{\partial \beta}\right)_V = \frac{1}{\beta} = kT$$
Note: I already pointed out that this result is valid at &quot;high&quot; temperatures, however, I did not give you a sense of scale. For hydrogen molecule $\theta^R = 87.6  \ K$ for chlorine molecule it is $ 0.351 K $. Similarly, the approximations made while deriving the translational functional are valid at room temperatures and for everyday macroscopic containers whose dimensions are much greater than the thermal wavelength ($\Lambda$) of the molecules.
A similar analysis can be performed for vibrational modes, however the temperature range over which it is valid is much greater ($&gt; 805 K$ for chlorine and $&gt; 6332 K $ for hydrogen). These conditions aren't within the realm of everyday experience.