The Boltzmann distribution states that the probability of having a particle with velocity $\vec v$ is proportional to $e^{-\frac{E}{kT}}d^3v$, where $E=\frac12 mv^2$ and $k$ is Boltzmann's constant.
So $$p(\vec v)=Ce^{-\frac{mv^2}{2kT}}$$
You get the integration constant $C$ from $\int p(\vec v)d^3v=1$, where you integrate over the entire space. Since the energy is direction independent, you can integrate the angular part, and you get $$\int_{angles}d^3v=4\pi v^2dv$$Then
$$C4\pi\int_0^\infty v^2e^{-\frac{mv^2}{2kT}}dv=1$$
This yields $$C=\left(\frac{m}{2\pi kT}\right)^{3/2}$$
You can use $R=N_Ak$ and $M=N_A m$to get $$p(\vec v)=\left(\frac{M}{2\pi RT}\right)^{3/2}e^{-\frac{Mv^2}{2RT}}$$
To get the average value of $v^2$, we need to do $$\langle v^2\rangle=\int v^2p(\vec v)d^3v=4\pi\int_0^\infty v^2v^2p(v)dv$$
One of the $v^2$ comes from the quantity you want to average, the other from transformation of the integral from $3D$ to $1D$. Plugging in the probability you now get the formula in your question. Note that there is a factor of $1/2$ in the exponential missing from your formula.
$\langle v^n \rangle = \int \vec{v^n} p(\vec{v});\mathrm{d}\vec{v}$
is true,
– heisenberg_px Oct 25 '19 at 06:26