TITLE: Evaluating $\int_{-\infty}^\infty\frac1{1+x^2+x^4+\cdots}\ \text{dx}$
QUESTION [11 upvotes]: I have calculated that
$$\begin{align}
\int_{-\infty}^\infty\frac1{1+x^2}\ \text{dx}&=\pi \\
\int_{-\infty}^\infty\frac1{1+x^2+x^4}\ \text{dx}&=\frac\pi{\sqrt3} \\
\int_{-\infty}^\infty\frac1{1+x^2+x^4+x^6}\ \text{dx}&=\frac\pi2 \\
\int_{-\infty}^\infty\frac1{1+x^2+x^4+x^6+x^8}\ \text{dx}&=\frac1 5\sqrt{10-2\sqrt5}\ \pi
\end{align}
$$
And thus I am trying to evaluate
$$
\lim_{\mathtt k\rightarrow\infty}\int_{-\infty}^\infty\frac1{1+x^2+\cdots+x^{2\mathtt k}}\ \text{dx}
=
\lim_{\mathtt k\rightarrow\infty}\int_{-\infty}^\infty\frac1{\sum_{n=0}^\mathtt kx^{2n}}\ \text{dx}=\ ?
$$
I intend to post a self-answer to this question, assuming a satisfactory answer is not posted within a few hours.

REPLY [9 votes]: This is a bit overkill for solving the question at hand, but for completness I'll add an answer for how one can evaluate the integral for a general value of $n$ using residue calculus giving us the result
$$\int_{-\infty}^\infty\frac{{\rm d}x}{1+x^2+\ldots+x^{2n}} = \frac{2\pi}{n+1}\frac{\cos\left(\frac{\pi}{2n+2}\right)}{\sin\left(\frac{3\pi }{2 n+2}\right)}\tag{1}$$
Taking the limit $n\to\infty$ in $(1)$ we get $\frac{4}{3}$, but this can of course be found by simpler methods as pointed to in the other answers.

By summing the geometrical series in the denominator we get
$$\int_{-\infty}^\infty\frac{{\rm d}x}{1+x^2+\ldots+x^{2n}} = \int_{-\infty}^\infty \frac{x^2-1}{x^{2n+2}-1}{\rm d}x$$
We now integrate the function $f(z) = \frac{z^2-1}{z^{2n+2}-1}$ around a semi-circle contour of radius $R$ in the upper half-plane. By the residue theorem we have
$$\oint f(z)\,{\rm d}z = \int_{-R}^R\frac{x^2-1}{x^{2n+2}-1}{\rm d}x + \int_{\rm semi-circle} \frac{z^2-1}{z^{2n+2}-1}{\rm d}z = 2\pi i \sum \text{Res}[f(z);z_k]$$
where $z_k$ are the poles of $f$ inside the contour. For $R>1$ these are given by the zeros of $z^{2n+2}-1$ in the upper half-plane (the singularities at $z=\pm 1$ are removable) so $z_k = e^{\frac{2\pi i}{2n+2} k}$ for $k=1,2,\ldots,n$. Since the poles of $f$ are simple the residues of $f$ are given by $$\text{Res}[f(z);z_k] = \frac{z_k^2-1}{\frac{d}{dz}(z^{2n+2}-1)_{z=z_k}} = \frac{z_k^2-1}{(2n+2)z_k^{2n+1}} = \frac{1}{2n+2}(z_k^3 - z_k)$$ where we have used $z_k^{2n+2} = 1$ to simplify. Taking $R\to \infty$ we find that the contribution from the semi-circle vanishes by a standard $M-L$ estimate since $|f(z)| \leq \frac{R^2}{R^{2n+2}-1} \sim \frac{1}{R^{2n}}$ and $\lim_{R\to\infty}\pi R \cdot \frac{1}{R^{2n}} = 0$ for all $n\geq 1$. This leads to
$$\int_{-\infty}^\infty\frac{z^2-1}{z^{2n+2}-1}{\rm d}z = \frac{2\pi i}{2n+2}\sum_{k=1}^n e^{3\frac{2\pi i}{2n+2} k} - e^{\frac{2\pi i}{2n+2} k} \\= \frac{2\pi i}{2n+2}\left(\frac{1+e^{\frac{3 i \pi }{n+1}}}{1-e^{\frac{3 i \pi }{n+1}}} - \frac{1+e^{\frac{i \pi }{n+1}}}{1-e^{\frac{i \pi }{n+1}}}\right) = \frac{2\pi}{n+1}\frac{\cos\left(\frac{\pi}{2n+2}\right)}{\sin\left(\frac{3\pi }{2 n+2}\right)}$$
where the sum above is another two geometrical series and I used Euler's formula to simplify the result.