<s>[INST] Computing $\int\limits_0^{\pi/2} {1 \over 1+8\sin^2(\tan x)}\ dx$ I’m trying to evaluate$$\int\limits_0^{\pi/2}dx\,\frac 1{1+8\sin^2(\tan x)}$$And made the substitution $u=\tan x$. Therefore$$I=\int\limits_0^{\infty}dx\,\frac 1{(1+x^2)(1+8\sin^2x)}$$Through some manipulations, you arrive at$$I=\int\limits_0^{\infty}dx\,\frac 1{(1+x^2)(5-4\cos 2x)}$$However, I’m confused what to do after that. The answer key started with$$\int\limits_0^{\infty} dx\,\frac 1{(1+x^2)(5-4\cos 2x)}=\int\limits_0^{\infty}dx\,\frac 1{1+x^2}\left(\frac 13+\frac 23\sum\limits_{k\geq1}\frac {\cos 2kx}{2^k}\right)$$However, I’m confused where they got the infinite sum from. Any ideas?
 [/INST] It is just a geometric series in disguise. You may consider that
$$ \sum_{k\geq 0}\frac{\cos(2kx)}{2^k}=\text{Re}\sum_{k\geq 0}\left(\frac{e^{2ix}}{2}\right)^k = \text{Re}\left(\frac{2}{2-e^{2ix}}\right) = 2\,\text{Re}\left(\frac{2-e^{-2ix}}{5-4\cos(2x)}\right)$$
equals $\frac{4}{5-4\cos(2x)}$. In particular
$$\begin{eqnarray*} \int_{0}^{+\infty}\frac{dx}{(1+x^2)(5-4\cos(2x))}&=&\frac{\pi}{6}+\frac{2}{3}\sum_{k\geq 1}\frac{1}{2^k}\int_{0}^{+\infty}\frac{\cos(2kx)}{1+x^2}\,dx\\&=&\frac{\pi}{6}+\frac{2}{3}\sum_{k\geq 1}\frac{\pi}{2^{k+1}e^{2k}}=\color{red}{\frac{\pi}{6}\cdot\frac{2e^2+1}{2e^2-1}}.\end{eqnarray*}$$
</s>