Integral for electric field I am having a real issue solving this integral. So a bit of background I am solving the following problem.

question 2.7 after doing the various equation with the electric field I got the following integral:
$$\frac{2\pi\sigma}{4\pi\epsilon}\int_{0}^{\pi}\frac{(R^2\sin\theta)(z-R\cos\theta)}{(z^2+R^2-2zR\cos\theta)^{3/2}}d\theta$$
after simplifying through substitution I get the following integral which is I honestly have no idea how to approach.
$$R\int \frac{z-w}{(z^2+R^2-2zw)^{3/2}}dw$$
I have not put limits in or anything as I am literally trying to figure out this integral.
I have searched the net and all that seems to come up is a standard solution of: $$\frac{wz-R^2}{z^2\sqrt{R^2+z^2-2w}}$$
but no where is a explanation of how this solution was found. Could someone please help me with a way to tackle this type of integral
Here is the integral before I made the second substitution to simplify the equation more.
$$E=\frac{2\pi\sigma}{4\pi\epsilon}\int_{-1}^{1} \frac{R^2(z-Ru)}{z^2+R^2-2xRu}du$$
 A: Note that we have
$$\begin{align}
\vec E&=\frac{\sigma}{4\pi\epsilon_0}\int_0^{2\pi}\int_0^\pi\frac{\hat zz-\hat rR}{(z^2+R^2-2zR\cos(\theta))^{3/2}}\,R^2\sin(\theta)\,d\theta\,d\phi\\\\
&=\frac{\sigma}{4\pi\epsilon_0}\int_0^{2\pi}\int_0^\pi\frac{\hat zz-(\hat x\sin(\theta)\cos(\phi)+\hat y\sin(\theta)\sin(\phi)+\hat z\cos(\theta))R}{(z^2+R^2-2zR\cos(\theta))^{3/2}}\,R^2\sin(\theta)\,d\theta\,d\phi\\\\
&=\frac{\sigma}{2\epsilon_0}\int_0^\pi\frac{\hat zz-\hat zR\cos(\theta)}{(z^2+R^2-2zR\cos(\theta))^{3/2}}\,R^2\sin(\theta)\,d\theta\\\\
&=\hat z\frac{\sigma R^2}{2\epsilon_0}\int_{-1}^1\frac{z-Rx}{(z^2+R^2-2zRx)^{3/2}}\,dx\tag1
\end{align}$$
Next, integrating by parts with $u=z-Rx$ and $v=\frac{1}{zR\sqrt{z^2+R^2-2zRx}}$ reveals
$$\begin{align}
\int_{-1}^1\frac{z-Rx}{(z^2+R^2-2zRx)^{3/2}}\,dx&=\frac{(z-R)}{zR|z-R|}-\frac{(z+R)}{zR(z+R)}+\frac{1}{z}\int_{-1}^{1} \frac1{\sqrt{z^2+R^2-2zRx}}\,dx\\\\
&=\frac{(z-R)-|z-R|}{zR|z-R|}-\frac{1}{z^2R}\left(|z-R|-(z+R)\right)\\\\
&=\begin{cases}\frac2{z^2}&,z>R\\\\0&,z<R\end{cases}\tag2
\end{align}$$
Substituting $(2)$ into $(1)$ yields
$$\vec E=\hat z\begin{cases}\frac{4\pi R^2 \sigma}{4\pi \epsilon_0 z^2}&z>R\\\\0&,z<R\end{cases}$$
