A homework problem from my complex analysis class:
Show that $\sum_{n = 1}^{\infty} r^n \cos n\theta = \frac{r \cos \theta - r^2}{1-2r\cos \theta + r^2}\,$ whenever $\, 0 < r < 1$.
I know that I must show $\Re(\frac{1}{1-z}) - 1 = \frac{r \cos \theta - r^2}{1-2r\cos \theta + r^2}\,$ since $\sum_{n=0}^{\infty}z^n = \frac{1}{1-z}$ whenever $|z| < 1$, but I am not sure how to calculate the real part of the complex number $\frac{1}{1-z}$.
More generally, what is a good approach to take when we want to find the real and imaginary parts of a complex number that has $i$ in the denominator?
First note that your series starts with $n=1$ not $n=0$, so you want $$\sum_{n=1}^\infty z^n=\frac{z}{1-z}\ .$$ Substituting $z=re^{i\theta}$ gives $$\sum_{n=1}^\infty r^ne^{ni\theta}=\frac{re^{i\theta}}{1-re^{i\theta}}$$ provided that $0\le r<1$. Now the conjugate of the denominator on the RHS is $1-re^{-i\theta}$, so we have $$\eqalign{\sum_{n=1}^\infty r^ne^{ni\theta} &=\frac{re^{i\theta}}{1-re^{i\theta}}\frac{1-re^{-i\theta}}{1-re^{-i\theta}}\cr &=\frac{re^{i\theta}-r^2}{1-r(e^{i\theta}+e^{-i\theta})+r^2}\cr &=\frac{re^{i\theta}-r^2}{1-2r\cos\theta+r^2}\ .\cr}$$ Now taking the real part of both sides is easy.
The usual way to simplify a quotient of complex numbers is to multiply numerator and denominator by the conjugate of the denominator. However there are cases which come up fairly frequently, which are more simply solved by the following kind of trick: $$\frac{1}{e^{3i\theta}-e^{-7i\theta}} =\frac{e^{2i\theta}}{e^{5i\theta}-e^{-5i\theta}} =\frac{e^{2i\theta}}{2i\sin5\theta}\ .$$