Integration of $\frac{1}{1+x^2+x^4+\cdots +x^{2m}}$ Please calculate $$A_m=\int _{-\infty}^{\infty}\frac{dx}{1+x^2+x^4+\cdots +x^{2m}}$$
My idea is $$A_m=\int \frac{1-x^2}{1-x^{2m+2}}\: dx$$ so I tried to use residue theorem to upper half circle with radius $R$.
But, I cannot calculate it.
 A: The residue method is a bit cumbersome, I suggest a more elementary series approach.
HINTS:
1:$$\int^\infty_{-\infty}=\int_{-\infty}^{-1}+\int_{-1}^{1}+\int^\infty_{1}$$
2: $$\frac1{1-x^{n}}=\sum_{k\ge0}x^{nk}$$ for $|x|<1$.
3: $$\frac1{1-x^{n}}=-\sum_{k\ge0}\frac1{x^{n}}x^{-nk}$$ for $|x|>1$.
4: $$\int \sum =\sum \int$$ at most time.
5: $$\sum_{k=-\infty}^{\infty}\frac1{x-k}=\pi\cot(\pi x)$$
I will elaborate later.
I found the answer to be ($2m+2=n$):
$$A_n=\frac{2\pi}n(-\cot(\frac{3\pi}n)+\cot(\frac{\pi}n))$$
EDIT:
Let $f(x)=\frac{1-x^2}{1-x^{n}}=\frac1{g(x)}-\frac{x^2}{g(x)}$.
$$\int^\infty_{-\infty}f(x)dx=\int_{-\infty}^{-1}\frac1{g(x)}dx+\int_{-1}^{1}\frac1{g(x)}dx+\int^\infty_{1}\frac1{g(x)}dx-(\int_{-\infty}^{-1}\frac{x^2}{g(x)}dx+\int_{-1}^{1}\frac{x^2}{g(x)}dx+\int^\infty_{1}\frac{x^2}{g(x)}dx)$$
The second integral equals
$$\sum_{k\ge0}\int_{-1}^{1}x^{nk}dx=\sum_{k\ge0}\frac2{nk+1}=2\sum_{k=-\infty}^0\frac1{1-nk}$$
The third integral equals
$$-\sum_{k\ge0}\int^\infty_{1}\frac1{x^{n}}x^{-nk}dx=-\sum_{k\ge1}\int^\infty_{1}x^{-nk}dx=\sum_{k\ge1}\frac1{1-nk}$$
With the map $x \mapsto -x$, It can be shown that the first and the third integrals are equal(note that $n$ is even).
So, the first three integrals combine to give
$$2\sum_{k=-\infty}^\infty\frac1{1-nk}=2\frac1n\sum_{k=-\infty}^\infty\frac1{1/n-k}=\frac{2\pi}n\cot(\pi/n)$$
For the other three integrals, with similar procedures, gives
$$2\sum_{k=-\infty}^\infty\frac1{3-nk}=2\frac1n\sum_{k=-\infty}^\infty\frac1{3/n-k}=\frac{2\pi}n\cot(3\pi/n)$$
Therefore, $$A_n=\frac{2\pi}n(\cot(\pi/n)-\cot(3\pi/n))$$
A: Let $\gamma$ be the upper half circle $C$ with radius $R$ centered at $0$ and the segment from $A=(-R,0)$ to $B=(R,0)$. Clearly, inside $\gamma$, the function $f(z)=\frac{z^2-1}{z^{2m+2}-1}$ has $m$ poles $z=\omega_k\equiv=e^{\frac{\pi i k}{m+1}}=\omega_1^k$, $k=1,2,\cdots,m$ and on $AB$, $f(x)$ has two removable singular points $-1$ and $1$. For large $R$, using $\omega_k^{2m+2}=1$ and
$$ \frac{1+e^{ix}}{1-e^{ix}}=i\cot(\frac x2),$$
one has
\begin{eqnarray}
\int_\gamma f(z)\: dz&=&2\pi i\sum_{k=1}^m\text{Res}(f(z),z=\omega_k)\\
&=&2\pi i\sum_{k=1}^m\frac{\omega_k^2-1}{(2m+2)\omega_k^{2m+1}}\\
&=&\frac{\pi i}{m+1}\sum_{k=1}^m\bigg[\omega_k^{-2m+1}-\omega_k^{-2m-1}\bigg]\\
&=&\frac{\pi i}{m+1}\sum_{k=1}^m\bigg[\omega_k^{3}-\omega_k\bigg]\\
&=&\frac{\pi i}{m+1}\sum_{k=1}^m\bigg[\omega_1^{3k}-\omega_1^k\bigg]\\
&=&\frac{\pi i}{m+1}\bigg[\omega_1^3\frac{1-\omega_1^{3m}}{1-\omega_1^3}-\omega_1\frac{1-\omega_1^{m}}{1-\omega_1}\bigg]\\
&=&\frac{\pi i}{m+1}\bigg[\frac{1+\omega_1^{3}}{1-\omega_1^3}-\frac{1+\omega_1}{1-\omega_1}\bigg]\\
&=&-\frac{\pi i}{m+1}\bigg[\cot(\frac{3\pi}{2(m+1)})-\cot(\frac{\pi}{2(m+1)})\bigg].
\end{eqnarray}
On $C$,
$$\bigg|\int_C \frac{z^2-1}{z^{2m+2}-1}\: dz\bigg|\le\int_C \bigg|\frac{z^2-1}{z^{2m+2}-1}\bigg|\: |dz|\le \int_C\frac{|z|^2+1}{|z|^{2m+2}-1}\: |dz|=\frac{R^2+1}{R^{2m+2}-1}2\pi R\to 0$$
as $R\to\infty$. On $AB$
$$ \int_{-R}^Rf(z)dz=\int_{-R}^Rf(x)dx\to\int_{-\infty}^\infty f(\infty)dx $$
as $R\to\infty$.
Thus
$$\int _{-\infty}^{\infty}f(x)dx=-\frac{\pi}{m+1}\bigg[\cot(\frac{3\pi}{2(m+1)})-\cot(\frac{\pi}{2(m+1)})\bigg].$$
