What am I doing wrong when integrating this? $$\int_0^{\infty} r^2 e^{\frac{-r^2}{2}} \, dr$$ I used integration by parts and set $u=r^2$ and $dv=e^{\frac{-r^2}{2}}dr$ and I get $$-re^{\frac{-r^2}{2}}+\frac{2e^{\frac{-r^2}{2}}}{-r} \Bigg|_0^{\infty}$$ but when I plug in the bounds I get $(0-0)-(0-\text{undefined})$? The answer key shows $\sqrt{\frac{\pi}{2}}$ and I even checked it on wolfram and got $\sqrt{\frac{\pi}{2}}$.
What did I do wrong?

Your choice of $dv$ is unlikely to work, since the integral of that function does not have an elementary expression - there's almost surely a mistake in your computation here.
Rather, try $u = r$ and $dv = r e^{-r^2/2}$. This leads to $v = -e^{-r^2/2}$, and
$$-re^{-r^2/2}\big|_0^{\infty} + \int_0^{\infty} e^{-r^2/2} dr$$
This last integral can be computed in a number of ways (e.g. polar coordinates), and is known to be $\sqrt{\pi/2}$. A good search term is "Gaussian integral."
It's worth mentioning that the function $r^2 e^{-r^2/2}$ does not have an elementary antiderivative, but rather one that must be expressed in terms of the error function (which just puts the Gaussian integral under the rug).