Proving $\int_0^{\pi} \frac{\log (1+r-2\sqrt{r}\cos(t))}{1+r-2\sqrt{r} \cos(t)}\,dt = \frac{2\pi}{1-r}\log(1-r)$, when $0 < r < 1$. I'm trying to prove that when $0 < r < 1$,
\begin{equation} \int_0^{\pi} \frac{\log (1+r-2\sqrt{r}\cos(t))}{1+r-2\sqrt{r} \cos(t)}\,dt = \frac{2\pi}{1-r}\log(1-r).\end{equation}
References:
Evaluating an easier integral $\int_0^{\pi} \log (1+r-2\sqrt{r}\cos(t))\,dt$ has many references, for example:
A question in Complex Analysis $\int_0^{2\pi}\log(1-2r\cos x +r^2)\,dx$
But I couldn't find a direct reference for the above problem.
My approach:
Motivated by solutions in the above post, I tried to express my integral as a contour integral:
$$
\int_0^{\pi} \frac{\log (1+r-2\sqrt{r}\cos(t))}{1+r-2\sqrt{r} \cos(t)}\,dt = \frac{1}{2} \int_0^{2\pi} \frac{\log (1+r-2\sqrt{r}\cos(t))}{1+r-2\sqrt{r} \cos(t)}\,dt = \int_{\gamma} \frac{\log |1-z|^2}{2iz|1-z|^2} \,dz,
$$
here $\gamma$ is the circle of radius $\sqrt{r}$ centered at the origin. I couldn't proceed further.
Could you help me with my approach or any other approach? Thank you in advance.
 A: $$\begin{align} \int_{0}^{\pi} \frac{\log(1+r^{2}-2r \cos t)}{1+r^{2} - 2 r \cos t} \, \mathrm dt &= \frac{1}{2} \int_{-\pi}^{\pi} \frac{\log(1+r^{2}-2r \cos t)}{1+r^{2} - 2 r \cos t} \, \mathrm dt \\ &= \Re \int_{-\pi}^{\pi} \frac{\log(1-re^{it})}{(1-re^{it})(1-re^{-it})} \, \mathrm dt \\ &=  \,  \Re \int_{|z|=1} \frac{\log (1-rz)}{(1-rz)(1-r/z)} \, \frac{ \mathrm dz}{iz} \\ &=  \,  \Re \, \frac{1}{i} \int_{|z|=1} \frac{\log (1-rz)}{(1-rz)(z-r)} \, \mathrm dz \end{align}$$
Since  $0 < r< 1$, the only singularity inside the unit circle is a simple pole at $z=r$.
Therefore,
$$ \begin{align}   \int_{0}^{\pi} \frac{\log(1+r^{2}-2r \cos t)}{1+r^{2} - 2 r \cos t} \, \mathrm dt &=  \Re\, \frac{1}{i}\, 2 \pi i \, \frac{\log(1-r^{2})}{1-r^{2}} \\ &= \frac{2 \pi}{1-r^{2}} \,  \log(1-r^{2}) \end{align}$$
A: Let $s = \sqrt{r} \in (0,1)$. Our starting point is the geometric series
$$ \sum \limits_{n=0}^\infty s^n \mathrm{e}^{\mathrm{i} n t} = \frac{1}{1 - s \mathrm{e}^{\mathrm{i} t}} \, . $$
Taking the real and the imaginary part of this equation and integrating the latter with respect to $t$ yields the Fourier series
$$ \frac{1}{1+s^2 - 2 s \cos(t)} = \frac{1}{1-s^2} \left[1 + 2 \sum \limits_{m=1}^\infty s^m \cos(m t)\right] $$
and 
$$ -\log(1+s^2 - 2 s \cos(t)) = 2 \sum \limits_{n=1}^\infty \frac{s^n}{n} \cos(nt) \, , $$
respectively. They converge in $L^2$, so we can plug them into the integral to obtain
\begin{align}
\int \limits_0^\pi \frac{-\log(1+s^2 - 2 s \cos(t))}{1+s^2 - 2 s \cos(t)} \, \mathrm{d} s &= \frac{2}{1-s^2} \sum \limits_{n=1}^\infty \frac{s^n}{n} \left[\int \limits_0^\pi \cos(n t) \, \mathrm{d} t \right.\\
&\phantom{=\frac{2}{1-s^2} \sum \limits_{n=1}^\infty \frac{s^n}{n} \left[\vphantom{\int \limits_0^\pi}\right.} + \left. 2\sum \limits_{m=1}^\infty s^m \int \limits_0^\pi \cos(n t) \cos(m t) \, \mathrm{d} t \right] \\
&= \frac{2}{1-s^2} \sum \limits_{n=1}^\infty \frac{s^n}{n} \left[0 + 2\sum \limits_{m=1}^\infty s^m \frac{\pi}{2} \delta_{nm} \right] = \frac{2 \pi}{1-s^2} \sum \limits_{n=1}^\infty \frac{s^{2n}}{n} \\
&= 2 \pi \frac{-\log(1-s^2)}{1-s^2} \, .
\end{align}
