Evaluate the integral $\int_{-1}^1 \frac{1}{x^2-2x\cos\alpha+1}\mathrm dx,\alpha\in(0,\pi)$ For the equation $x^2-2x\cos\alpha+1=0$ solutions are
$$x_1=\cos\alpha-\sqrt{\cos^2\alpha-1},x_2=\cos\alpha+\sqrt{\cos^2\alpha-1}\Rightarrow$$
$$\int_{-1}^1 \frac{1}{x^2-2x\cos\alpha+1}\mathrm dx=\int_{-1}^1 \frac{1}{(x-\cos\alpha+\sqrt{\cos^2\alpha-1})(x-\cos\alpha-\sqrt{\cos^2\alpha-1})}\mathrm dx$$
$\frac{1}{(x-\cos\alpha+\sqrt{\cos^2\alpha-1})(x-\cos\alpha-\sqrt{\cos^2\alpha-1})}=\frac{A}{(x-\cos\alpha+\sqrt{\cos^2\alpha-1})}+\frac{B}{(x-\cos\alpha-\sqrt{\cos^2\alpha-1})}\Rightarrow$
$$A=\frac{-1}{2\sqrt{\cos^2\alpha-1}},B=\frac{1}{2\sqrt{\cos^2\alpha-1}}\Rightarrow$$
$$\int_{-1}^1 \frac{1}{x^2-2x\cos\alpha+1}\mathrm dx=\frac{-1}{2\sqrt{\cos^2\alpha-1}}\left(\int_{-1}^1 \frac{1}{x-\cos\alpha+\sqrt{\cos^2\alpha-1}}\mathrm dx - \int_{-1}^1 \frac{1}{x-\cos\alpha-\sqrt{\cos^2\alpha-1}}\mathrm dx\right)$$
How to evaluate these partial integrals?

If we let $t = \cos \alpha$, we have $$\frac{1}{x^2 - 2t x + 1} = \frac{1}{(x-t)^2 + (1-t^2)} = \frac{1}{1-t^2} \cdot \frac{1}{\frac{(x-t)^2}{1-t^2} + 1}.$$  This suggests using the substitution $$u = \frac{x-t}{\sqrt{1-t^2}}, \quad du = \frac{1}{\sqrt{1-t^2}} \, dx.$$  This results in the indefinite integral $$\frac{1}{\sqrt{1-t^2}} \int \frac{1}{u^2 + 1} \, du = \csc \alpha \tan^{-1} u + C = \csc \alpha \tan^{-1} \frac{x-\cos \alpha}{\sin \alpha} + C. $$  Now evaluating this integral at the endpoints gives $$\int_{x=-1}^1 \frac{dx}{x^2 - 2x\cos \alpha  + 1} = \csc \alpha \left(\tan^{-1} \frac{1 - \cos \alpha}{\sin \alpha} + \tan^{-1} \frac{1+\cos \alpha}{\sin \alpha} \right),$$ and because $$\frac{1 - \cos \alpha}{\sin \alpha} \cdot \frac{1+\cos \alpha}{\sin \alpha} = 1,$$ it follows that the term in parentheses is $\pi/2$ for $\alpha \in (0,\pi)$; hence the answer is $$\frac{\pi}{2 \sin \alpha}.$$
