This is the so called equipartition theorem, that says that each degree of freedom contributes with $\frac{k_BT} {2} $ to the average energy, or using mol $\frac{RT} {2} $. More precisely, each degree of freedom in the Hamiltonian that is quadratic contributes for $\frac{k_BT} {2} $.
If we can write the energy:$ E = \sum_n \alpha_n x^2_n$ like a sum of quadratic degrees of freedom, we can compute the average, using <PERSON> distribution: $$ \langle E \rangle =\frac{\int E \exp(-\beta E) d^3 x_1...d^3 x_N}{\int \exp(-\beta E) d^3 x_1...d^3 x_N} = \frac{\int \sum_n \alpha_n x^2_n\exp(-\beta \sum_n \alpha_n x^2_n) d^3 x_1...d^3 x_N} {\int \exp(-\beta \sum_n \alpha_n x^2_n) d^3 x_1...d^3 x_N} $$ We can factorize, using the property of the exponential and Gaussian integrals: $$ \frac{\int \alpha x^2\exp(-\beta \alpha x^2) d^3 x} {\int \exp(-\beta \alpha x^2) d^3 x} = \frac{\frac{\alpha \sqrt{\pi} }{2{(\alpha \beta})^{\frac{3}{2} } }} {\frac{\sqrt{\pi}}{{(\alpha \beta})^{\frac{1}{2} } }} = \frac{1} { 2 \beta} $$ Knowing that: $\beta = \frac{1} {k_B T} $, we have: $$ \langle E \rangle = N f \frac{k_B T} {2} $$ Where $N$ is the number of molecules and $f$ is the number of degrees of freedom per molecule. Or writing this for a mole of gas: $\langle E \rangle = f \frac{R T} {2}$, where $R$ is the constant of gas.
Now, we know that the heat capacity at constant volume is: $C_V = \frac{d\langle E \rangle}{dT}$ then we have: $$ C_V = f \frac{R} {2} $$
For a perfect monoatomic gas, where we neglect interactions, we have only the kinetic term: $$ E = \sum_n^N \frac{p^2_n}{2m}$$ Where the sum is over the number of molecules. 374
Using the equipartition theorem we have: $\langle E \rangle = N(\frac{3}{2})k_B T$ or $\langle E \rangle = \frac{3} {2}RT$. The factor of $3N$ arise from the number of molecules and the fact that we have three dimensional space, then we have three degrees of freedom from the momentum of each molecule. Clearly the degrees of freedom include translational, rotational and vibrational terms, depending on the system. 246