Complex Analysis: find $\int_0^{2\pi}\frac{R\cos t}{R^2 - 2Rr\cos t + r^2}dt$ Suppose $0<r<R$. Find $\int_0^{2\pi}\dfrac{R\cos t}{R^2 - 2Rr\cos t + r^2}dt$ using a contour integral. 
(Note: I've been able to solve similar problems, and I understand the concepts, but I can't figure out how to solve this one in particular. Any help is appreciated.) 
 A: Using the Poisson Kernel, we have that
\begin{align}
u(a+re^{i\theta})= \frac{1}{2\pi}\int^{\pi}_{-\pi}\left[ \frac{R^2-r^2}{R^2-2Rr\cos(\theta-t)+r^2}\right]u(a+Re^{it})\ dt.
\end{align}
In particular, if $u(x, y) = \operatorname{Re}[z] = x, a=0$ and $\theta=0$, then 
\begin{align}
u(r) = r = \frac{1}{2\pi}\int^\pi_{-\pi}\left[ \frac{R^2-r^2}{R^2-2Rr\cos(t)+r^2}\right]R\cos(t)\ dt
\end{align}
which means
\begin{align}
\int^{2\pi}_{0} \frac{R\cos(t)}{R^2-2Rr\cos(t)+r^2}\ dt=\int^\pi_{-\pi} \frac{R\cos(t)}{R^2-2Rr\cos(t)+r^2}\ dt = \frac{2\pi r}{R^2-r^2}.
\end{align}
I chose not to use contour integration.
A: Our integral equals
$$ I=\text{Re}\int_{0}^{2\pi}\frac{R e^{it}}{(R-r e^{it})(R-r e^{-it})}\,dt=\text{Re}\left(\frac{1}{i}\oint_{|z|=1}\frac{R}{(R-rz)(R-r/z)}\,dz\right) $$
and the last integrand function has a single pole inside the unit circle, a simple pole at $z=\frac{r}{R}$.
It follows that:
$$ I = 2\pi\cdot\text{Re}\,\text{Res}\left(\frac{R}{(R-rz)(R-r/z)},z=\frac{r}{R}\right)=\color{red}{\frac{2\pi r}{R^2-r^2}}. $$
