<s>[INST] Finding $\int_0^\pi\frac{f\left(\alpha+e^{ix}\right)+f\left(\alpha+e^{-ix}\right)}{1+2p\cos(x)+p^2}\mathrm dx$ Let $f$ be a analytic function in the closed unit circle with its center
at the point $\alpha\in\mathbb{R}$, then:
\begin{equation*}
\int_0^\pi\frac{f\left(\alpha+e^{ix}\right)+f\left(\alpha+e^{-ix}\right)}{1+2p\cos(x)+p^2}\mathrm dx=\frac{2\pi}{1-p^2}f(\alpha+p) ,
\end{equation*}
for $|p|<1$.
My attempt: By
\begin{align*}
\therefore\quad \sum_{n=1}^{\infty}p^{n}\sin(nx)=\frac{p\sin (x)}{1-2p\cos (x)+p^2},\qquad|p|<1
\end{align*}
adjusting $p\to -p$ and highlighting $\displaystyle \frac1{1+2p\cos(x)+p^2}$:
\begin{align*}
\frac1{1+2p\cos(x)+p^2}=-\frac{1}{\sin(x)}\sum_{n=1}^\infty(-p)^{n}\sin(nx).
\end{align*}
Thus:
\begin{align*}
\int_0^\pi\frac{f\left(\alpha+e^{ix}\right)+f\left(\alpha+e^{-ix}\right)}{1+2p\cos(x)+p^2}\mathrm dx=-\sum_{n=1}^\infty(-p)^{n}\int_0^\pi\left\{f\left(\alpha+e^{ix}\right)+f\left(\alpha+e^{-ix}\right)\right\}\frac{\sin(nx)}{\sin(x)}\mathrm dx\tag{1}
\end{align*}
by the \textit{Dirichlet Kernel}: $\displaystyle \sum_{k=0}^{N-1}e^{2ikx}=e^{(N-1)x}\frac{\sin(Nx)}{\sin(x)}$ setting $N\to n$, $n\in\mathbb{N}$ and then taking $(1)$, follows that:
\begin{align*}
&=-\sum_{n=1}^\infty(-p)^{n}\sum_{k=0}^{n-1}\int_0^\pi\left\{f\left(\alpha+e^{ix}\right)+f\left(\alpha+e^{-ix}\right)\right\}e^{-(n-1)x}e^{2ikx}\mathrm dx,\quad\left(e^{ix}\to z\right)\\
&=...
\end{align*}
At this point I'm out of ideas. I would like some light on my last step, or another approach that is similar to this one.
 [/INST] Integrate as follows
\begin{align}
&\int_0^\pi\frac{f\left(\alpha+e^{ix}\right)+f\left(\alpha+e^{-ix}\right)}{1+2p\cos x+p^2} dx\\
=&\int_0^\pi\frac{2\Re f\left(\alpha+e^{ix}\right)}{1+2p\cos x+p^2} dx
= 2\int_0^\pi\frac{\sum_{k=0}^\infty \frac{f^{(k)}(a)}{k!} \cos(kx)}{1+2p\cos x+p^2} dx\\
=& \> 2\sum_{k=0}^\infty \frac{f^{(k)}(a)}{k!} \int_0^\pi \frac{\cos(kx)}{1+2p\cos x+p^2} dx\\
 =& \> 2\sum_{k=0}^\infty \frac{f^{(k)}(a)}{k!}\cdot \frac{\pi (-p)^k}{1-p^2}=
\frac{2\pi}{1-p^2}f(\alpha-p)
\end{align}
where
$$\eqalign{
\frac{1-p^2}{1+2p\cos x+p^2}
=1+2\sum_{j=1}^\infty (-p)^j\cos(j x)
}
$$
is used to integrate
$\int_0^\pi \frac{\cos(kx)}{1+2p\cos x+p^2} dx=\frac{\pi (-p)^k}{1-p^2}$.
</s>