Express $w=f(z)=\frac{1}{(1-z)^2}$ in the form $w=u(x,y)+iv(x,y)$ I start by writing $f(z)$ as $$\frac{1}{(1-(x+iy))^2}$$
and then I expand the bottom to get $$\frac{1}{(1-2x+x^2-y^2) + i(2y-2xy)}$$
The answer says $$w=\frac{(1+x^2-2x-y^2)-(i(2xy-2y)}{(1+x^2-2x-y^2)^2+(2xy-2y)^2}$$
How do I get to this stage?

You can simplify this process a bit:
$$\begin{align}
\frac1{(1-z)^2} & =\left(\frac1{1-z}\right)^2=\left(\frac{1-\overline z}{(1-z)(1-\overline z)}\right)^2\\
& = \left({1-\overline z\over 1-z-\overline z+|z|^2}\right)^2\\
& = \left({1-x+iy\over 1-2x+x^2+y^2}\right)^2,\quad\text{since }z+\overline z=2x\\
& = {1-2x+x^2-y^2+2iy(1-x)\over(1-2x+x^2+y^2)^2}\\
& ={1-2x+x^2-y^2\over(1-2x+x^2+y^2)^2}+{2y(1-x)\over(1-2x+x^2+y^2)^2}i.
\end{align}$$
