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?
 A: How the the series turns out: note that $\cos(t)=\frac{1}{2}(e^{it}+e^{-it})$ and
$$\begin{align}\frac{1}{5-4\cos(t)}&=\frac{1}{5-2(e^{it}+e^{-it})}
=\frac{1/4}{(1-e^{-it}/2)(1-e^{it}/2)}\\
&=\frac{e^{-it}/2}{3(1-e^{-it}/2)}+\frac{1}{3(1-e^{it}/2)}\\
&=\frac{1}{3}\sum_{k\geq 1}\frac{e^{-ikt}}{2^{k}}
+\frac{1}{3}\sum_{k\geq 0}\frac{e^{ikt}}{2^k}\\
&=\frac{1}{3}+\sum_{k\geq 1}\frac{e^{ikt}+e^{-ikt}}{2^k}
=\frac{1}{3}+\frac{2}{3}\sum_{k\geq 1}\frac{\cos(kt)}{2^k}.
\end{align}$$
A: 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*}$$
