How would you evaluate the following expression? It seems very difficult to simplify the trig. 
I have tried to many different ways and I also end up with a tan inside an arctan which I do not know how to simplify. Please suggest how I can solve this. Am I missing something simple or is it quite tricky and need some sort of manipulation that I am missing.
 A: By symmetry we can reduce the interval to $[0,\frac{\pi}4]$, the coefficient before the integral sign becomes $8$.
$$I=\frac 8{\pi}\int_0^{\frac{\pi}4}\dfrac{\cos(4x)^2+1}{a\cos(2x)^2+1}dx$$
Then by substitution $u=2x$:
$$I=\frac 4{\pi}\int_0^{\frac{\pi}2}\dfrac{\cos(2u)^2+1}{a\cos(u)^2+1}du$$
The reason behind reducing the interval is to be able to have a bijective change $t=\tan(u)$:
We expand $\cos(2u)$ and replace $\cos(u)^2$ by $\frac 1{1+t^2}$:
$$I=\frac 8{\pi}\int_0^{\infty}\dfrac{t^4+1}{(t^2+a+1)(t^2+1)^2}du$$
The next part is partial fraction decomposition and integration in arctan, it is not difficult but tedious, so I skip it and jump to the result:
$$\dfrac {\tfrac{a^2+2a+2}{a^2}}{t^2+a+1}-\dfrac {\frac{2a+2}{a^2}}{t^2+1}+\dfrac {\frac 2a}{(t^2+1)^2}$$
$$I=4\times\frac{(a^2+2a+2)-\sqrt{1+a}(a+2)}{a^2\sqrt{1+a}}$$
We now have to solve $I=a$ :
$4(a^2+2a+2)-4\sqrt{1+a}(a+2)=a^3\sqrt{1+a}\iff 4(a^2+2a+2)=\sqrt{1+a}(a^3+4a+8)$
We square both sides and simplify to:
$$a^7+a^6+8a^5+8a^4-32a^3-48a^2=0$$
And since $a\neq 0$ we are glad to arrive to the desired expression:

$$a^5+a^4+8a^3+8a^2-32a=48$$

