<s>[INST] Solving a complex integral I need help solving an integral from John Conway book. 
Lets $\alpha$ complex number different from 1 find integral $$\int\frac{dx}{1-2\alpha\cos{x}+{\alpha}^2}$$ from 0 to $2\pi$ in unit circle $$(z-\alpha)^{-1}(z-\frac{1}{\alpha})^{-1}$$
 [/INST] Let $t=\tan(x/2) $ so that $\cos x = \frac{1-t^2}{1+t^2}$ and $dx=\frac{2 dt}{1+t^2}.$ The integral becomes $$ \int \frac{1}{1-2\alpha \frac{1-t^2}{1+t^2} + \alpha^2} \frac{2 dt}{1+t^2}=2 \int \frac{dx}{(\alpha-1)^2+ (\alpha+1)^2 t^2}= \frac{1}{\alpha^2-1} \tan^{-1} \left( \frac{(\alpha+1)t}{\alpha-1} \right)+ C= \frac{1}{\alpha^2-1} \tan^{-1} \left( \frac{(\alpha+1)\tan(x/2)}{\alpha-1} \right)+ C$$
</s>