Chebyshev coefficient of $1/(z-x)$ In his paper "The Evaluation and Estimation of the Coefficients in the Chebyshev Series Expansion of a Function", David Elliott writes:

Writing $x = \cos(\theta)$, it can easily be shown that
  $$
\int_{-1}^1 \frac{T_n(x)}{\sqrt{1-x^2} \, (z-x)} \, dx
=
\int_0^\pi \frac{\cos(n\theta)}{z - \cos(\theta)}\, d\theta
=
\frac{\pi}{\sqrt{z^2-1} \, (z\pm \sqrt{z^2-1})^n}
$$
  where the sign is chosen so that $|z \pm \sqrt{z^2 -1}| > 1$. 

The middle expression here has been added by myself to show what you get after the substitution $x= \cos(\theta)$. I fail to see how the second equality comes about. Any pointers would be greatly appreciated. 
 A: A simple observation is that the coefficients
$$c_n:=\int_{-1}^{+1}{T_n(x)\over\sqrt{1-x^2}(z-x)}dx$$
satisfy the same linear recurrence of the $T_n(x).$
substituting $T_{n+1}=2xT_n-T_{n-1} =2zT_n-2(z-x)T_n-T_{n-1}$ into the integral formula for $c_{n+1}$ one gets, for any $n>0$ 
$$c_{n+1}=2zc_{n}  -c_{n-1}.$$
(Recall that $\int_{-1}^{+1}{T_n(x)\over\sqrt{1-x^2}}dx=0$ for $n>0$, an instance of the orthogonality).
Taking into account the values of $c_0$ and $c_1$, one finds $c_n$ as a linear combination of  $U_n(z)$ and $T_n(z)$.
A: The integral equals $\frac12\int_{-\pi}^\pi \frac{e^{in\theta}}{z-\cos \theta}d\theta$. Consider the integral over the rectangle with vertices $\pm \pi$, $\pm \pi+iT$ for large $T>0$. The integrals over vertical sides cancel, since the function if $2\pi$-periodic, the integral over high horizontal side tends to 0 for large $T$. So, the difference between the integral over $[-\pi,\pi]$ and over rectangular contour tends to 0. The value of the contour integral may be calculated using residues. The equation $\cos \theta=z$ has two series of solutions $\pm \theta_0+2\pi k,k\in \mathbb{Z}$, without loss of generality the point $\theta_0$ is the unique root inside the contour. It remains to calculate the residue $e^{in\theta_0}/-\sin\theta_0$ that is straightforward, you only have to be careful with the sign of $\sin\theta_0=\pm\sqrt{1-z^2}$.
