<s>[INST] Prove $\frac{1}{2 \pi} \int_0^{2\pi} \frac{1 - r^2}{1 + r^2 - 2r \cos{t}} dt = 1$ using contour integration The question is to solve the integral using concepts of contour integrals:
$$\frac{1}{2 \pi}   \int_0^{2\pi} \frac{1 - r^2}{1 + r^2 - 2r \cos{t}} dt = 1$$
 [/INST] Remark: the integrand $P_r(t)$ is known as the Poisson kernel and the result follows immediately from a term-by-term integration of the normally converging (when $0\leq r<1$) series $P_r(t)=\sum_{n\in\mathbb{Z}}r^{|n|}e^{in t}$ over $[0,2\pi]$. But since you want contour integration...
Hint: when $0<r<1$ use Cauchy's integral formula given that
$$
\frac{1-r^2}{1+r^2-2r\cos t}=\mbox{Re}\left( \frac{1+re^{it}}{1-re^{it}}\right)=\mbox{Re}\left( \frac{1+z}{1-z}\right)\qquad z=re^{it}
$$
and factor $r^2$ out in the numerator and the denominator to reduce to the latter when $r>1$, which yields $-1$.
Details upon request: when $0<r<1$, the function$f(z)=\frac{1+z}{1-z}$ is holomorphic on the open unit disk, which contains $\gamma$ the circle of radius $r$ and center $0$. So by Cauchy's integral formula
$$1=f(0)=\frac{1}{2i\pi}\int_\gamma \frac{f(z)}{z}dz=\frac{1}{2i\pi}\int_0^{2\pi} \frac{1+re^{it}}{1-re^{it}}\cdot \frac{ire^{it}}{re^{it}}dt=\frac{1}{2\pi}\int_0^{2\pi} \frac{1+re^{it}}{1-re^{it}}dt$$whence
$$1=\mbox{Re}\left(\frac{1}{2\pi}\int_0^{2\pi} \frac{1+re^{it}}{1-re^{it}}dt\right)=\frac{1}{2\pi}\int_0^{2\pi}\mbox{Re}\left( \frac{1+re^{it}}{1-re^{it}}\right)dt=\frac{1}{2\pi}\int_0^{2\pi}\frac{1-r^2}{1+r^2-2r\cos t}dt.$$
When $r>1$, we have
$$
\frac{1}{2\pi}\int_0^{2\pi}\frac{1-r^2}{1+r^2-2r\cos t}dt=\frac{1}{2\pi}\int_0^{2\pi}\frac{-r^2(1-r^{-2})}{r^2(1+r^{-2}-2r^{-1}\cos t)}dt=-1
$$
by application of the above to $0<r^{-1}<1$.
For $r=0$, we find $1$. And for $r=1$, we get $0$.
</s>