Prove that $\int_{-\infty}^{+\infty} \frac{1}{x^4+x^2+1}dx = \frac{\pi}{\sqrt{3}}$

The next step is to write, for example, $$\frac{x+1}{x^2+x+1} = \frac{1}{2} \cdot \frac{2x+1}{x^2+x+1} + \frac{1}{2} \cdot \frac{1}{x^2+x+1}$$ from which we then have $$\int \frac{x+1}{x^2+x+1} \, dx = \frac{1}{2} \log\left|x^2+x+1\right| + \frac{1}{2} \int \frac{dx}{(x+1/2)^2+(\sqrt{3}/2)^2},$$ and the second integral is, after an appropriate substitution, expressible as an inverse tangent. A analogous approach applies to the other term in your original expression.


$$\int_{\mathbb{R}}\frac{dx}{x^4+x^2+1}=2\int_{0}^{+\infty}\frac{dx}{x^4+x^2+1} = 2\int_{0}^{1}\frac{dx}{x^4+x^2+1}+2\int_{0}^{1}\frac{x^2\,dx}{x^4+x^2+1}$$ so we just have to find: $$ I=2\int_{0}^{1}\frac{1+x^2}{1+x^2+x^4}\,dx = 2\int_{0}^{1}\frac{1-x^4}{1-x^6}\,dx.$$ By expanding the integrand function as a geometric series we have: $$ I = 2\sum_{n=0}^{+\infty}\left(\frac{1}{6n+1}-\frac{1}{6n+5}\right)=2\sum_{n=1}^{+\infty}\frac{\chi(n)}{n} $$ where $\chi(n)$ is the primitive non-principal Dirichlet character $\!\!\pmod{6}$. Since, by the residue theorem:

$$\frac{x^2+1}{x^4+x^2+1}=-\frac{i}{2\sqrt{3}}\left(\frac{1}{x-\omega}+\frac{1}{x-\omega^2}-\frac{1}{x-\omega^4}-\frac{1}{x-\omega^5}\right)$$ where $\omega=\exp\frac{2\pi i}{6}$, it follows that: $$ I = \int_{0}^{1}\left(\frac{1}{1-x+x^2}+\frac{1}{1+x+x^2}\right)\,dx=\frac{2\pi}{3\sqrt{3}}+\frac{\pi}{3\sqrt{3}}=\color{red}{\frac{\pi}{\sqrt{3}}}. $$

As an alternative approach, we can just manipulate the series representation: $$ I = 2\sum_{n\geq 0}\frac{4}{(6n+3)^2-4}=\frac{1}{9}\sum_{n\geq 0}\frac{8}{(2n+1)^2-\frac{4}{9}}\tag{1}$$ through the logarithmic derivative of the Weierstrass product for the cosine function: $$ \cos z = \prod_{n\geq 0}\left(1-\frac{4z^2}{(2n+1)^2 \pi^2}\right), $$ $$ \tan z = \sum_{n\geq 0}\frac{8z}{(2n+1)^2 \pi^2 - 4z^2}$$ $$ \pi\tan(\pi z) = \sum_{n\geq 0}\frac{8z}{(2n+1)^2 - 4z^2}\tag{2}$$ from which it follows that: $$ I = \frac{\pi}{3}\tan\frac{\pi}{3} = \frac{\pi}{\sqrt{3}}.\tag{3} $$


\begin{align} \int_{-\infty}^{\infty} \frac{1}{x^4+x^2+1}\,\mathrm dx&=2\int_{0}^{\infty} \frac{1}{x^4+x^2+1}\,\mathrm dx\\[7pt] &=2\int_{0}^{\infty} \frac{1}{\left(x-\frac{1}{x}\right)^2+3}\cdot\frac{\mathrm dx}{x^2}\\[7pt] &=2\int_{0}^{\infty} \frac{1}{\left(y-\frac{1}{y}\right)^2+3}\,\mathrm dy\tag1\\[7pt] &=\int_{-\infty}^{\infty}\frac{1}{\left(y-\frac{1}{y}\right)^2+3}\,\mathrm dy\\[7pt] &=\int_{-\infty}^{0}\frac{1}{\left(y-\frac{1}{y}\right)^2+3}\,\mathrm dy+\int_{0}^{\infty}\frac{1}{\left(y-\frac{1}{y}\right)^2+3}\,\mathrm dy\\[7pt] &=\int_{-\infty}^{\infty}\frac{e^{z}}{\left(e^{z}-e^{-z}\right)^2+3}\,\mathrm dz+\int_{-\infty}^{\infty}\frac{e^{-z}}{\left(e^{-z}-e^{z}\right)^2+3}\,\mathrm dz\tag2\\[7pt] &=\int_{-\infty}^{\infty}\frac{2\cosh z}{\left(2\sinh z\right)^2+3}\,\mathrm dz\tag3\\[7pt] &=\int_{-\infty}^{\infty}\frac{1}{t^2+3}\,\mathrm dt\tag4\\[7pt] &=\left.\frac{\arctan\left(\frac{t}{\sqrt{3}}\right)}{\sqrt{3}}\right|_{-\infty}^{\infty}\\[7pt] &=\bbox[5pt,border:3px #FF69B4 solid]{\color{red}{\large\frac{\pi}{\sqrt{3}}}}\tag{$\color{red}{❤}$} \end{align}


Explanation :

$(1)\;$ Use substitution $\;\displaystyle y=\frac{1}{x}\quad\implies\quad \mathrm dy=-\frac{\mathrm dx}{x^2}$

$(2)\;$ Use substitution $\;\displaystyle y=e^{z}\,$ for the left integral and $\;\displaystyle y=e^{-z}\,$ for the right integral

$(3)\;$ Adding both integrals then using the fact that $\;\displaystyle \cosh z=\frac{e^{z}+e^{-z}}{2}\,$ and $\;\displaystyle \sinh z=\frac{e^{z}-e^{-z}}{2}\,$

$(4)\;$ Use substitution $\;\displaystyle t=2\sinh z\quad\implies\quad \mathrm dt=2\cosh z\;\mathrm dz$