If one has a probability density function $P(x)$, then the expectation value of a quantity $f(x)$ is given by
$$\langle f \rangle = \int f(x)P(x)\,\mathrm{d}x$$
evaluated over the limits of the probability density function, i.e. if your PDF runs from $-\infty$ to $\infty$, then those are your limits of integration.
In our case, the PDF is the Maxwell-Boltzmann distribution (denoted $P(v)$ here) and the quantity we want to find the expectation value of is simply the velocity, $v$. Since velocity can only be positive (as far as our model is concerned), the limits of integration are from $0$ to $\infty$.
Therefore, the mean velocity $\langle v \rangle$ is given by the integral
$$\langle v \rangle = \int_0^\infty v P(v)\,\mathrm{d}v$$
where $P(v)$ is the Maxwell-Boltzmann distribution
$$P(v) = \left(\frac{m}{2\pi kT}\right)^{3/2}4\pi v^2 \exp{\left(-\frac{mv^2}{2kT}\right)}$$
So:
$$\begin{align}
\langle v \rangle &= \int_0^\infty v P(v)\,\mathrm{d}v \\
&= 4\pi\left(\frac{m}{2\pi kT}\right)^{3/2} \int_0^\infty v^3 \exp{\left(-\frac{m}{2kT}v^2\right)}\,\mathrm{d}v
\end{align}$$
The integral can be evaluated using integration by parts repeatedly. The process is not interesting and you could consult a table of standard integrals to find the result:
$$\int_0^\infty v^3 \exp{(-\alpha v^2)}\,\mathrm{d}v = \frac{1}{2\alpha^2}$$
Setting $\alpha = m/2kT$,
$$\begin{align}
\langle v \rangle &= 4\pi\left(\frac{m}{2\pi kT}\right)^{3/2} \frac{4k^2T^2}{2m^2} \\
&= \sqrt{\frac{8kT}{\pi m}} \\
\end{align}$$
$m$ here refers to the mass of one molecule, whereas $M$ in your question refers to the molar mass of the compound. They are related by $M = N_\mathrm{A}m$, where $N_\mathrm{A}$ is the Avogadro constant. Since $R = N_\mathrm{A}k$, you can multiply top and bottom by $N_\mathrm{A}$ to obtain the desired result
$$\langle v \rangle = \sqrt{\frac{8RT}{\pi M}}$$