The volume element for integrals in spherical coordinates is expressed as $d^3r = r^2\sin(θ)\,dr\,d\theta\,d\phi$ and in cases where the integrand depends only on $r$, the angles can be integrated out. When the angles are integrated out, this apparently results in a factor of $4\pi$ which is multiplied by whatever the radial component is.
I don’t understand why the angular contribution is $4\pi$. When I integrate the inner integral $$\int_0^{2\pi} \sin\theta\,d\theta$$ I get $-\cos(2\pi) - - \cos(0) = -1 -- 1 = 0$, which is never going to give me $4\pi$. Wolfram Alpha agrees this integral is zero, so I must be fundamentally misunderstanding the problem. What am I doing wrong?
The comment helped clear up the confusion. My integral limits were set because I was treating $\theta$ as the azimuthal angle, which is the usual convention I've seen. But the angle with the sin in the volume element formula is the polar angle. So whichever angle you treat as polar angle is integrated from 0 to $\pi$, which yields 2, not 0. The other angle is just the angle integrated from 0 to 2$\pi$. Multiply them together, you get 4$\pi$ as advertised.