<s>[INST] 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. 
 [/INST] 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.
</s>