Solve for $\int_{0}^{+\infty} \frac{\ln \left(x^{2}+2 \sin a \cdot x+1\right)}{1+x^{2}} d x$ It is known that $$\int_{0}^{+\infty} \frac{\ln \left(x^{2}+2 \sin a \cdot x+1\right)}{1+x^{2}} d x=\pi \ln \left|2 \cos \frac{a}{2}\right|+a \ln \left|\tan \frac{a}{2}\right|+2 \sum_{k=0}^{+\infty} \frac{\sin (2 k+1) a}{(2 k+1)^{2}}$$
In an attempt to derive the equation, I utilized 
$$\sum_{n=0}^{\infty}\left(\frac{e^{i x}}{a}\right)^{n}=\frac{1}{1-\frac{e^{i x}}{a}}=\frac{a(a-\cos x)}{a^{2}-2 a \cos x+1}+i \frac{a \sin x}{a^{2}-2 a \cos x+1}$$, where a>1
and $$\sum_{n=0}^{\infty}\left(ae^{i x}\right)^{n}=\frac{1}{1-ae^{i x}}=\frac{a(a-\cos x)}{a^{2}-2 a \cos x+1}+i \frac{a \sin x}{a^{2}-2 a \cos x+1}$$, where a<1
The series expansion for $\ln \left(x^{2}+2 \sin a \cdot x+1\right)$ can be obtained by integrating the imaginary part of the equation and plugging in $x=\frac{\pi}{2}-a$, $a=x$
However, I still failed to get the desired result by using this series expansion. I wonder whether I can obtain the equation through such Fourier series or I just missed some important point. Any help would be appreciated. 
 A: Another series solution, which might be helpful.
$$I(a)=\int_{0}^{+\infty} \frac{\ln \left(x^{2}+2 \sin a \cdot x+1\right)}{1+x^{2}} d x$$
$$x=\tan t$$
$$I(a)=\int_{0}^{\pi/2} \left(\ln \left(1+2 \sin a \sin t \cos t\right)-2\ln \cos t \right) d t$$
$$I(a)=\int_{0}^{\pi/2} \ln \left(1+2 \sin a \sin t \cos t\right)dt+ \pi \ln 2$$
Now substitute $t=y/2$:
$$I(a)=\pi \ln 2+\frac12 \int_{0}^{\pi} \ln \left(1+\sin a \sin y \right)dy $$
Expanding into a series:
$$I(a)=\pi \ln 2+\frac12 \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} \sin^n a \int_{0}^{\pi} \sin^n y dy $$
Using symmetry:
$$I(a)=\pi \ln 2+\sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} \sin^n a \int_{0}^{\pi/2} \sin^n y dy $$
The integrals can be evaluated easily enough:
$$\int_{0}^{\pi/2} \sin^n y dy=\int_0^1 \frac{u^n du}{\sqrt{1-u^2}}=\frac{1}{2} \int_0^1 \frac{v^{(n-1)/2} dv}{\sqrt{1-v}}= \frac{1}{2} B \left(\frac{n+1}{2}, \frac12 \right)$$
Which gives us:

$$I(a)=\pi \ln 2+\frac12 \sum_{n=1}^\infty \frac{(-1)^{n+1}}{n} B \left(\frac{n+1}{2}, \frac12 \right) \sin^n a  $$

This is not the same series the OP wanted to obtain, however it's nice and converges fast.
The OP series is Fourier series, which I think is harder to get.
A: After I have figured out that $\pi\log2\cos\left(\frac a2\right)$ stands for $\pi\log\left(2\cos\left(\frac a2\right)\right)$ (and not for $\pi\log(2)\cdot\cos\left(\frac a2\right)$ as I thought) a few things suddenly became clear. Furthermore I would like to ask for a reference on the part of "it is known".
Let's start! As mentioned in the comments by Sonal_sqrt maybe Feynman is the way to go. So, consider the integral $I(a)$ using the obvious parameterization. Note that $I(0)=\pi\log(2)$. Differentiate w.r.t. $a$ we obtain
\begin{align*}
\frac{\mathrm d}{\mathrm da}\int_0^\infty\frac{\log(x^2+2x\sin(a)+1)}{1+x^2}\mathrm dx&=\int_0^\infty\frac{\partial}{\partial a}\frac{\log(x^2+2x\sin(a)+1)}{1+x^2}\mathrm dx\\
&=\int_0^\infty\frac{2x\cos(a)}{(1+x^2)(x^2+2x\sin(a)+1)}\mathrm dx\\
&=\cot(a)\left[\int_0^\infty\frac{\mathrm dx}{1+x^2}-\int_0^\infty\frac{\mathrm dx}{x^2+2x\sin(a)+1}\right]\\
&=\frac\pi2\cot(a)-\frac1{\sin(a)}\left[\frac\pi2-a\right]\\
\therefore~\frac{\mathrm d}{\mathrm da}\int_0^\infty\frac{\log(x^2+2x\sin(a)+1)}{1+x^2}\mathrm dx&=\frac\pi2\cot(a)-\frac\pi2\frac1{\sin(a)}+\frac a{\sin(a)}
\end{align*}
Integrating back reduces the problem to
$$\int_0^\infty\frac{\log(x^2+2x\sin(a)+1)}{1+x^2}\mathrm dx=\pi\log\left(2\cos\left(\frac a2\right)\right)+\int_0^a\frac{a'}{\sin(a')}\mathrm da'$$
Where we already used that $I(0)=\pi\log(2)$ (the rest are elementary integrals, nothing really interesting). Using Integration By Parts (and utilizing the Clausen Function, in particular its capability of expressing closed-form anti-derivatives for logarithmo-trigonometric integrals) we may get
\begin{align*}
\int_0^a\frac{a'}{\sin(a')}\mathrm da'&=\frac a2\log\left(\frac{1-\cos(a)}{1+\cos(a)}\right)-\frac12\int_0^a\log\left(\frac{1-\cos(a')}{1+\cos(a')}\right)\mathrm da'\\
&=a\log\left(\tan\left(\frac a2\right)\right)-2\int_0^{\frac a2}\log(\tan a')\mathrm da'\\
&=a\log\left(\tan\left(\frac a2\right)\right)+\operatorname{Cl}_2(a)+\operatorname{Cl}_2(\pi-a)
\end{align*}
This expression may be further "simplified" as
\begin{align*}
a\log\left(\tan\left(\frac a2\right)\right)+\operatorname{Cl}_2(a)+\operatorname{Cl}_2(\pi-a)&=2\operatorname{Ti}_2\left(\tan\frac a2)\right)\\
&=a\log\left(\tan\left(\frac a2\right)\right)+2\sum_{n\geqslant0}\frac{\sin[(2n+1)a]}{(2n+1)^2}
\end{align*}
The first equality follows from here while the second is a more or less well-known result due to Ramanujan.

$$\small\therefore~\int_0^\infty\frac{\log(x^2+2x\sin(a)+1)}{1+x^2}\mathrm dx~=~\pi\log\left(2\cos\left(\frac a2\right)\right)+a\log\left(\tan\left(\frac a2\right)\right)+2\sum_{n\geqslant0}\frac{\sin[(2n+1)a]}{(2n+1)^2}$$

Of course, we do not need the whole power of Ramanujan's identity as we can prove the crucial relation between the occuring Clausen Functions and the sum directly using the Fourier Series representation of the Clausen Function. I omitted explanations for trigonometric manipulations as they are quite straightforward.
A: Let's follow the advice by @Sonal_sqrt. For $-\pi/2<a<3\pi/2$,
$$\int_0^\infty\frac{\cos a\ dx}{1+2x\sin a+x^2}=\tan^{-1}\left.\frac{x+\sin a}{\cos a}\right|_{x=0}^{x=\infty}=\frac{\pi}{2}-a,$$
so, if $I(a)$ is the given integral, then (for the same range of $a$)
\begin{align}
I'(a)&=\int_0^\infty\frac{2x\cos a\ dx}{(1+x^2)(1+2x\sin a+x^2)}
\\&=\cot a\int_0^\infty\left(\frac{1}{1+x^2}-\frac{1}{1+2x\sin a+x^2}\right)dx
\\&=\cot a\left(\frac{\pi}{2}-\frac{1}{\cos a}\Big(\frac{\pi}{2}-a\Big)\right)=\frac{a}{\sin a}-\frac{\pi}{2}\tan\frac{a}{2}.
\end{align}
Knowing $I(0)=-2\int\limits_0^{\pi/2}\ln\cos t\,dt=\pi\ln 2$, and integrating $a/\sin a$ by parts, we have
$$I(a)=\pi\ln\Big|2\cos\frac{a}{2}\Big|+a\ln\Big|\tan\frac{a}{2}\Big|-\int_0^a\ln\Big|\tan\frac{x}{2}\Big|\,dx.$$
Finally, note that
$$-\ln\Big|\tan\frac{x}{2}\Big|=\Re\ln\frac{1+e^{ix}}{1-e^{ix}}=2\sum_{n=0}^{\infty}\frac{\cos(2n+1)x}{2n+1},$$
and integrability of this series is shown using Dirichlet's test.
