It's basically a triple integral in spherical coordinates. I understand how they did the integration wrt $\phi$ and $\theta$, but I don't understand the "trick" for doing it wrt $r$ since they get an absolute value thing in there.
Is there some u-substitution that I'm supposed to be doing? The $\frac{1}{rz}$ is especially making it harder.
$$ I(z,r)=\int_0^\pi \frac{\sin\theta}{\sqrt{z^2+r^2-2rz\cos\theta}} d\theta $$ is the one giving trouble, if I understand correctly. In these cases, if it is one of the first few times you are facing these integrals, it can be useful to substitute $\cos\theta = u$, so that $-\sin\theta\, d\theta = du$ and we are able to perform the integral with respect to $u$ directly $$ I(z,r) = \int_{-1}^{+1} \frac{1}{\sqrt{z^2+r^2-2rzu}}du = -\frac{1}{rz}\sqrt{z^2+r^2-2rzu}\Big|_{-1}^{+1}=\frac{1}{rz}(\sqrt{z^2+2rz + r^2}-\sqrt{z^2-2rz+r^2}) =\frac{1}{rz}(\sqrt{(z+r)^2}-\sqrt{(z-r)^2}) $$ and, since $\sqrt{\alpha^2}=|\alpha|$ for any real number $\alpha$, we have $$ I(z,r)=\frac{1}{rz}(|z+r|-|z-r|)\,. $$ I see from the picture that your textbook assumes $z\ge0$, while $r$ is always nonnegative since it is the radial coordinate; then the first absolute value is actually not necessary. The second one must be discussed as you see there.