log and poisson-like integral Here is a fun looking one some may enjoy. 
Show that:
$$\int_{0}^{1}\log\left(\frac{x^{2}+2x\cos(a)+1}{x^{2}-2x\cos(a)+1}\right)\cdot \frac{1}{x}dx=\frac{\pi^{2}}{2}-\pi a$$
 A: Starting from
$$
{\rm Log}(1+x e^{ia})=\sum_{n=1}^\infty\frac{(-1)^{n-1}e^{ina}}{n}x^n
$$
we see that
$$
\int_0^1{\rm Log}(1+x e^{ia})\cdot \frac{1}{x}dx=\sum_{n=1}^\infty\frac{(-1)^{n-1}e^{ina}}{n^2}
$$
Taking real parts we get
$$
\int_0^1 \log|1+x e^{ia}|\cdot \frac{1}{x}dx=\sum_{n=1}^\infty\frac{(-1)^{n-1}\cos(na)}{n^2}
$$
applying this to $a+\pi$ instead of $a$ we obtain also
$$
\int_0^1 \log|1-x e^{ia}|\cdot \frac{1}{x}dx=-\sum_{n=1}^\infty\frac{\cos(na)}{n^2}
$$
Subtracting these two formulas:
$$
\int_0^1 \log\frac{|1+x e^{ia}|}{|1-x e^{ia}|}\cdot \frac{1}{x}dx=
\sum_{n=1}^\infty\frac{((-1)^{n-1}+1)\cos(na)}{n^2}
=\sum_{n=0}^\infty\frac{2\cos((2n+1)a)}{(2n+1)^2}
$$
or
$$
\int_0^1 \log\left(\frac{1+2x\cos(a)+x^2}{ 1-2x \cos(a)+x^2 }\right)\cdot \frac{1}{x}dx
=\sum_{n=0}^\infty\frac{4\cos((2n+1)a)}{(2n+1)^2}\tag{1}
$$
On the other hand if $f$ is the $2\pi$-periodic even function that coincides with $a\mapsto \frac{\pi^2}{2}-\pi a$ on $[0,\pi]$ then it is straightforward to check that the Fourier series expansion of $f$ coincides with the right side of $(1)$. So, we have shown that
$$
\int_0^1 \log\left(\frac{1+2x\cos(a)+x^2}{ 1-2x \cos(a)+x^2 }\right)\cdot \frac{1}{x}dx
=\frac{\pi^2}{2}-\pi |a|
$$
for $a\in[-\pi,\pi]$.$\qquad\square$
A: Denote
$$
I(r)
=\int_{0}^{1}\log\left(\frac{x^{2}+2x r +1}{x^{2}-2x r+1}\right)\cdot \frac{1}{x}dx
$$
then 
$$
\begin{align}
\frac{dI}{dr}
&=\int_0^1 \frac{4 \left(x^2+1\right)}{\left(2-4 r^2\right) x^2+x^4+1} dx\\
&=\int_0^1 \left(\frac{2}{x^2+2rx+1}+\frac{2}{x^2-2 r x+1} \right)dx\\
&=\frac{2 \tan ^{-1}\left(\frac{x+r}{\sqrt{1-r^2}}\right)}{\sqrt{1-r^2}}\Biggl|_0^1
+\frac{2 \tan ^{-1}\left(\frac{x-r}{\sqrt{1-r^2}}\right)}{\sqrt{1-r^2}}\Biggl|_0^1\\
&=\frac{2}{\sqrt{1-r^2}}\left(\tan ^{-1}\left(\frac{x+r}{\sqrt{1-r^2}}\right)+\tan ^{-1}\left(\frac{x-r}{\sqrt{1-r^2}}\right)\right)\Biggl|_0^1\\
&=\frac{2}{\sqrt{1-r^2}}\tan^{-1}\frac{\frac{x+r}{\sqrt{1-r^2}}+\frac{x-r}{\sqrt{1-r^2}}}{1-\frac{x+r}{\sqrt{1-r^2}}\frac{x-r}{\sqrt{1-r^2}}}\Biggl|_0^1\\
&=\frac{2}{\sqrt{1-r^2}}\tan^{-1}\frac{2x\sqrt{1-r^2}}{1-x^2}\Biggl|_0^1\\
&=\frac{2}{\sqrt{1-r^2}}\frac{\pi}{2}\\
&=\frac{\pi}{\sqrt{1-r^2}}\\
\end{align}
$$
Since $I(0)=0$, then
$$
I(\cos a)=I(0)+\int_0^{\cos a} \frac{dI}{dr}dr=\int_0^{\cos a}\frac{\pi}{\sqrt{1-r^2}}dr=\pi\sin^{-1}s|_0^{\cos a}=\frac{\pi^{2}}{2}-\pi a
$$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{\int_{0}^{1}\ln\pars{x^{2} + 2x\cos\pars{a} + 1
     \over x^{2} - 2x\cos\pars{a} + 1}\,{\dd x \over x}:\ {\large ?}}$

\begin{align}
&x^{2} + 2\cos\pars{a}x + 1\quad\mbox{has roots}\quad
-p\quad\mbox{and}\quad -p^{*}\quad\mbox{where}\quad p \equiv \expo{\ic a}
\\[3mm]&\mbox{Similarly,}\quad
x^{2} - 2\cos\pars{a}x + 1\quad\mbox{has roots at}\quad p\quad\mbox{and}\quad p^{*}.\qquad
\mbox{Note that}\quad pp^{*} = 1.
\end{align}

Then, with $\ds{0 < \epsilon < 1}$:
\begin{align}
&\int_{\epsilon}^{1}\ln\pars{x^{2} + 2x\cos\pars{a} + 1
\over x^{2} - 2x\cos\pars{a} + 1}\,{\dd x \over x}
\\[3mm]&=
\int_{\epsilon}^{1}{\ln\pars{x + p} \over x}\,\dd x
+\int_{\epsilon}^{1}{\ln\pars{x + p^{*}} \over x}\,\dd x
-\int_{\epsilon}^{1}{\ln\pars{x - p} \over x}\,\dd x
-\int_{\epsilon}^{1}{\ln\pars{x - p^{*}} \over x}\,\dd x
\end{align}

However,
  \begin{align}
&\int_{\epsilon}^{1}{\ln\pars{x + b} \over x}\,\dd x
=-\ln\pars{b}\ln\pars{\epsilon}
+\int_{\epsilon}^{1}{\ln\pars{x/b + 1} \over x}\,\dd x
\\[3mm]&=-\ln\pars{b}\ln\pars{\epsilon}
+\int_{\epsilon/b}^{1/b}{\ln\pars{x+ 1} \over x}\,\dd x
=-\ln\pars{b}\ln\pars{\epsilon}
+\int_{-\epsilon/b}^{-1/b}{\ln\pars{1 - x} \over x}\,\dd x
\\[3mm]&=-\ln\pars{b}\ln\pars{\epsilon}
-\int_{-\epsilon/b}^{-1/b}{{\rm Li}_{1}\pars{x} \over x}\,\dd x
=-\ln\pars{b}\ln\pars{\epsilon}
-\int_{-\epsilon/b}^{-1/b}{\rm Li}_{2}'\pars{x}\,\dd x
\end{align}
  $$
\begin{array}{|c|}\hline\\ \quad
\int_{\epsilon}^{1}{\ln\pars{x + b} \over x}\,\dd x
=-\ln\pars{b}\ln\pars{\epsilon} + {\rm Li}_{2}\pars{-\,{\epsilon \over b}}
-{\rm Li}_{2}\pars{-\,{1 \over b}}
\quad\\ \\ \hline
\end{array}
$$

Since $\ds{pp^{*} = 1}$, we get in the limit $\ds{\epsilon \to 0^{+}}$:
\begin{align}
&\int_{0}^{1}\ln\pars{x^{2} + 2x\cos\pars{a} + 1
\over x^{2} - 2x\cos\pars{a} + 1}\,{\dd x \over x}
\\[3mm]&=-{\rm Li}_{2}\pars{-\,{1 \over p}}
-{\rm Li}_{2}\pars{-\,{1 \over p^{*}}}
+{\rm Li}_{2}\pars{1 \over p}
+{\rm Li}_{2}\pars{1 \over p^{*}}
\\[3mm]&=-\bracks{{\rm Li}_{2}\pars{-p} + {\rm Li}_{2}\pars{-\,{1 \over p}}}
+\bracks{{\rm Li}_{2}\pars{p} + {\rm Li}_{2}\pars{1 \over p}}
\end{align}

\begin{align}
&\int_{0}^{1}\ln\pars{x^{2} + 2x\cos\pars{a} + 1
\over x^{2} - 2x\cos\pars{a} + 1}\,{\dd x \over x}
\\[3mm]&=-\bracks{{\rm Li}_{2}\pars{-\expo{\ic a}}
+{\rm Li}_{2}\pars{-\expo{-\ic a}}}
+\bracks{{\rm Li}_{2}\pars{\expo{\ic a}} + {\rm Li}_{2}\pars{\expo{-\ic a}}}
\end{align}
  This is the general solution for $\ds{a \in {\mathbb R}}$. The OP proposed solution is found when $\ds{0 \leq a \leq \pi}$. A little later, I'll explain how to handle the general case by means of the DiLogarithm Inversion Formula.

A: I understand that this an old question but I would like to share my 2 cents. First of all we recall the following Fourier identities:
Lemma 1: Let $x \in [-\pi, \pi]$ then 
$$\sum_{n=1}^{\infty} \frac{\sin nx}{n} = \frac{\pi-x}{2} \Rightarrow \sum_{n=1}^{\infty} \frac{\cos n x}{n^2} = \frac{\pi^2}{6}  -\frac{\pi x}{2} + \frac{x^2}{4} \tag{1}$$
Lemma 2: Let $x \in [-\pi, \pi]$ then
$$\sum_{n=1}^{\infty} \frac{(-1)^n \sin nx}{n} = - \frac{x}{2} \Rightarrow \sum_{n=1}^{\infty} \frac{(-1)^n \cos nx}{n^2} = \frac{x^2}{4} - \frac{\pi^2}{12} \tag{2}$$
Lemma 3: It holds that:
$$\ln \left ( 1 - 2x \cos a + x^2 \right ) = -2\sum_{n=1}^{\infty} \frac{x^n \cos na}{n} \tag{3}$$
Hence for $a \in [0, \pi]$
\begin{align*}
\ln \left ( \frac{1+2x \cos a + x^2}{1-2x \cos a + x^2} \right ) &= \ln \left ( 1 + 2x \cos a + x^2 \right ) - \ln \left ( 1 - 2x \cos a + x^2 \right ) \\ 
 &=-2 \sum_{n=1}^{\infty} \frac{(-x)^n \cos na}{n}  + 2 \sum_{n=1}^{\infty} \frac{x^n \cos na}{n} \\ 
 &= -2 \sum_{n=1}^{\infty} \frac{\left ( (-x)^n - x^n \right ) \cos na}{n} \\
 &= 4 \sum_{n=1}^{\infty} \frac{x^{2n+1} \cos (2n+1)a}{2n+1} 
\end{align*}
since $(-x)^n - x^n$ is $0$ whenever $n$ is even. Hence,
\begin{align*}
\int_0^1 \frac{1}{x} \ln \left( \frac{1+2x\cos a+x^2}{ 1-2x \cos a+x^2 } \right) \, \mathrm{d}x &= 4\int_{0}^{1} \frac{1}{x} \sum_{n=0}^{\infty} \frac{x^{2n+1} \cos (2n+1)a}{2n+1} \, \mathrm{d}x \\ 
 &=4 \sum_{n=0}^{\infty} \frac{\cos(2n+1)a}{2n+1} \int_{0}^{1} x^{2n} \, \mathrm{d}x \\ 
 &=4 \sum_{n=0}^{\infty} \frac{\cos (2n+1)a}{(2n+1)^2} 
\end{align*}
This is nothing else than $\chi_2$ Legendre function directly associated with the series in $(1)$, $(2)$. Hence,
\begin{align*}
\sum_{n=0}^{\infty} \frac{\cos (2n+1)a}{(2n+1)^2} & = \mathfrak{Re} \left ( \sum_{n=0}^{\infty}  \frac{e^{i(2n+1)a}}{(2n+1)^2}  \right )  \\ 
 &=\frac{1}{2}\mathfrak{Re} \left ( \mathrm{Li}_2 \left ( e^{ia} \right )  - \mathrm{Li}_2 \left ( - e^{ia} \right ) \right )
\end{align*}
The real part of $\mathrm{Li}_2(e^{ix})$ is equation $(1)$ whereas the real part of $\mathrm{Li}_2(-e^{ix})$ is equation $(2)$. Thus, 
\begin{align*}
4\sum_{n=0}^{\infty} \frac{\cos (2n+1)a}{\left ( 2n+1 \right )^2} &= 2 \left ( \frac{\pi^2}{6} - \frac{\pi a}{2} + \frac{a^2}{4} - \frac{a^2}{4} + \frac{\pi^2}{12} \right ) \\ 
 &=\frac{\pi^2}{2} - \pi a
\end{align*}
Because the LHS is even so must be the RHS. So, the result can be extended for $a \in [-\pi, 0]$. Therefore, 
$$\int_0^1 \frac{1}{x} \ln \left( \frac{1+2x\cos a+x^2}{ 1-2x \cos a+x^2 } \right) \, \mathrm{d}x = \frac{\pi^2}{2} - \pi \left| a \right|$$
