<s>[INST] closed form of $\int_{0}^{2\pi}\frac{dx}{(a^2\cos^2x+b^2\sin^2x)^n}$ closed form of $$\int_{0}^{2\pi}\frac{dx}{(a^2\cos^2x+b^2\sin^2x)^n}$$
for $a,b>0$
n=1 we get
$$\int_{0}^{2\pi}\frac{dx}{(a^2\cos^2x+b^2\sin^2x)^1}=\frac{2\pi}{ab}$$
n=2 we get
$$\int_{0}^{2\pi}\frac{dx}{(a^2\cos^2x+b^2\sin^2x)^2}=\frac{\pi(a^2+b^2)}{a^3b^3}$$
but what the integral for n ????
I hope to be there two different solution one by contour integration and the other by real analysis and thanks for all
 [/INST] In the following we assume that $n\geq 1$.
Thanks to parity, the integral can be written as
\begin{align}
I_n=\int_0^{2\pi}\frac{dx}{(a^2\cos^2x+b^2\sin^2 x)^n}&=2\int_0^{\pi}\frac{dx}{(a^2\cos^2x+b^2\sin^2 x)^n}=\\
&=2\int_0^{\pi}\frac{dx}{(\frac{a^2+b^2}{2}+\frac{a^2-b^2}{2}\cos 2x)^n}=\\
&=\frac{1}{i}\oint_{|z|=1}\frac{z^{-1}dz}{(\frac{a^2+b^2}{2}+\frac{a^2-b^2}{2}\frac{z+z^{-1}}{2})^n}=\\
&=\frac{2^{2n}}{(a^2-b^2)^n}\frac{1}{i}\oint_{|z|=1}\frac{z^{-1}dz}{(z+z^{-1}-c-c^{-1})^n}=\\
&=\frac{2^{2n}}{(a^2-b^2)^n}\frac{1}{i}\oint_{|z|=1}\frac{z^{n-1}dz}{(z-c)^n(z-c^{-1})^n}
\end{align}
where the parameter $c$ is defined by the equation
$$c+c^{-1}=2\frac{b^2+a^2}{b^2-a^2}.$$
In particular, we can (and will) set $\displaystyle c=\frac{b-a}{b+a}$. Now for $b>a>0$ the point $z=c$ is inside, and $z=c^{-1}$ outside the unit circle. Therefore, by residues,
\begin{align}
I_n&=2\pi\cdot\frac{2^{2n}}{(a^2-b^2)^n}\cdot\mathrm{res}_{z=c}\frac{z^{n-1}}{(z-c)^n(z-c^{-1})^n}=\\
&=\frac{2\pi}{(n-1)!}\cdot\frac{2^{2n}}{(a^2-b^2)^n}\cdot\left[\frac{d^{n-1}}{dz^{n-1}}
\frac{z^{n-1}}{(z-\frac{b+a}{b-a})^n}\right]_{z=\frac{b-a}{b+a}}
\end{align}
In particular,
\begin{align}
I_1&=\frac{2\pi}{ab},\\
I_2&=\frac{\pi(a^2+b^2)}{a^3b^3},\\
I_3&=\frac{\pi(3a^4+2a^2b^2+3b^4)}{4a^5b^5},\\
&\ldots
\end{align}
Explicit computation (by RGB)
We can compute the residue explicitly by using the binomial formula.
We have that $$z^{n-1}=c^{n-1}\left(1+\frac{z-c}{c}\right)^{n-1}=\sum_{k=0}^{\infty}\binom{n-1}{k}\frac{(z-c)^k}{c^{k-n+1}},$$
and that $$(z-c^{-1})^{-n}=(c-c^{-1})^{-n}\left(1+\frac{z-c}{c-c^{-1}}\right)^{-n}=\sum_{k=0}^{\infty}\binom{-n}{k}\frac{(z-c)^k}{\left(c-c^{-1}\right)^{k+n}}.$$
We multiply these two to get a series $\sum_{k=0}^{\infty}A_k(z-c)^k$. We need then to divide by $(z-c)^n$ and get the coefficient of the term with degree $-1$. This will be the coefficient $A_{n-1}$.
Using the formula for the product of two series we get 
$$A_{n-1}=\sum_{r=0}^{n-1}\frac{\binom{n-1}{r}}{c^{r-n+1}}\frac{\binom{-n}{n-1-r}}{\left(c-c^{-1}\right)^{2n-r-1}}.$$
Finally we get $$I_n=2\pi\cdot\frac{2^{2n}}{(a^2-b^2)^n}\cdot\sum_{r=0}^{n-1}\frac{\binom{n-1}{r}}{c^{r-n+1}}\frac{\binom{-n}{n-1-r}}{\left(c-c^{-1}\right)^{2n-r-1}}.$$
Explicit computation II (by O.L.)
Let us write
 $$\frac{z^{n-1}}{(z-c^{-1})^n}=\frac{((z-c^{-1})+c^{-1})^{n-1}}{(z-c^{-1})^n}=\sum_{k=0}^{n-1}{n-1\choose k}c^{k+1-n}(z-c^{-1})^{k-n}$$
 We have to compute $(n-1)$th derivative of this expression and then evaluate it at $z=c$. This gives the formula
 $$I_n=2\pi\cdot\frac{2^{2n}}{(a^2-b^2)^n}\cdot\sum_{k=0}^{n-1}(-1)^{n-1}{n-1\choose k}{2n-2-k\choose n-1}c^{k+1-n}(c-c^{-1})^{k-2n+1}$$
which is equivalent to that of RGB.
</s>