<s>[INST] How can we show that $\int_{0}^{2\pi}{x\over \phi-\cos^2(x)}\mathrm dx=2\pi^2?$ We have the integral

$$\int_{0}^{2\pi}{x\over \phi-\cos^2(x)}\mathrm dx=2\pi^2\tag1$$
  $\phi$; Golden ratio

What method do we employ to prove $(1)$?
An attempt:
If we use $u=\phi-\cos^2 x$ then $\int_{\phi-1}^{\phi-1}(...)du=0$
Another way, $(1)$ becomes
$${1\over 2\sqrt{\phi}}\int_{0}^{2\pi}\left({x\over \sqrt{\phi}-\cos x}-{x\over \sqrt{\phi}+\cos x} \right)\mathrm dx\tag2$$
We got a hint by using 
$z=\tan{x\over 2}$, $dx={2dz\over 1+z^2}$, $\cos x={1-z^2\over 1+z^2}$ and $\sin x={2z\over 1+z^2}$
Let try on
$$\int_{0}^{2\pi}{x\over \sqrt{\phi}+\cos x}\mathrm dx=4\int_{0}^{0}{\tan^{-1} z\over (1+z^2)\sqrt{\phi}+1-z^2}\cdot (1-z^2)\mathrm dz=0?\tag3$$
Doesn't seem to work.
How else can we prove $(1)$?
 [/INST] A purely real approach.
Consider the integral
$$C(a,b)=\int_0^{\pi}\frac{\mathrm dx}{a+b\cos(x)^2}$$
It has already been shown by other users that your integral is given by $2\pi C(\phi,-1)$. 
We commence with the substitution $t=\tan\frac{x}2$:
$$C(a,b)=2\int_0^\infty \frac1{a+b\left[\frac{1-t^2}{1+t^2}\right]^2}\frac{\mathrm dt}{1+t^2}$$
$$C(a,b)=2\int_0^\infty\frac{1+t^2}{a(t^2+1)^2+b(t^2-1)^2}\mathrm dt$$
$$C(a,b)=2\int_0^\infty\frac{1+t^2}{(a+b)t^4+2(a-b)t^2+a+b}\mathrm dt$$
$$C(a,b)=\frac2{a+b}\int_0^\infty\frac{1+t^2}{t^4+2gt^2+1}\mathrm dt$$
Where $g=\frac{a-b}{a+b}$. We may split up the integral:
$$C(a,b)=\frac2{a+b}\int_0^\infty\frac{\mathrm dt}{t^4+2gt^2+1}+\frac2{a+b}\int_0^\infty\frac{t^2\mathrm dt}{t^4+2gt^2+1}$$
Then we pay attention to $$N_{n}(s)=\int_0^\infty \frac{x^{2n}}{x^4+2sx^2+1}\mathrm dx$$
With the substitution $x=1/u$, we have 
$$N_n(s)=-\int_\infty^0 \frac{\frac1{u^{2n}}}{\frac1{u^4}+\frac{2s}{u^2}+1}\frac{\mathrm du}{u^2}$$
$$N_n(s)=\int_0^\infty \frac{u^{2-2n}\mathrm du}{u^4+2su^2+1}$$
$$N_n(s)=N_{1-n}(s)$$
So we have
$$C(a,b)=\frac4{a+b}\int_0^\infty\frac{\mathrm dt}{t^4+2gt^2+1}$$
For this remaining integral, we recall that 
$$\begin{align}
\frac1{x^4+(2-c^2)x^2+1}&=\frac1{(x^2+cx+1)(x^2-cx+1)}\\
&=\frac1{4c}\frac{2x+c}{x^2+cx+1}-\frac1{4c}\frac{2x-c}{x^2-cx+1}+\frac14\frac1{x^2+cx+1}+\frac14\frac1{x^2-cx+1}
\end{align}$$
So we have that 
$$K(c)=\int_0^\infty \frac{\mathrm dx}{x^4+(2-c^2)x^2+1}$$
becomes
$$K(c)=\frac1{4c}\int_0^\infty\frac{2x+c}{x^2+cx+1}\mathrm dx-\frac1{4c}\int_0^\infty\frac{2x-c}{x^2-cx+1}\mathrm dx\\
+\frac14\int_0^\infty \frac{\mathrm dx}{x^2+cx+1}+\frac14\int_0^\infty \frac{\mathrm dx}{x^2-cx+1}$$
The first two integrals are easy, and end up vanishing, so we end up with 
$$K(c)=\frac14I(1,c,1)+\frac14I(1,-c,1)$$
Where 
$$I(a,b,c)=\int_0^\infty \frac{\mathrm dx}{ax^2+bx+c}=\frac2{\sqrt{4ac-b^2}}\arctan\frac{2ax+b}{\sqrt{4ac-b^2}}\bigg]_0^\infty\\
=\frac\pi{\sqrt{4ac-b^2}}-\frac2{\sqrt{4ac-b^2}}\arctan\frac{b}{\sqrt{4ac-b^2}}$$
Hence
$$K(c)=\frac\pi{2\sqrt{4-c^2}}$$
So we see that
$$C(a,b)=\frac4{a+b}K\left(2\sqrt{\frac{b}{a+b}}\right)=\frac\pi{\sqrt{a^2+ab}}$$
And since, by definition, $\phi^2-\phi=1$, we have that 
$$C(\phi,-1)=\pi$$
Which gives, as desired,
$$\int_0^{2\pi}\frac{x\mathrm dx}{\phi-\cos(x)^2}=2\pi^2$$
</s>