Evaluate the integral $\int_0^\infty \frac{x (\ln(x))^2}{x^4 + x^2 + 1}\text{ d}x$
Solution 1:
\begin{align} \int^\infty_0\frac{x\ln^2{x}}{x^4+x^2+1}dx &=\frac{1}{8}\int^\infty_0\frac{\ln^2{x}}{x^2+x+1}dx\\ &=\frac{1}{4}\int^1_0\frac{(1-x)\ln^2{x}}{1-x^3}dx\\ &=\frac{1}{4}\sum^\infty_{n=0}\int^1_0\left(x^{3n}-x^{3n+1}\right)\ln^2{x}dx\\ &=\frac{1}{2}\sum^\infty_{n=0}\left(\frac{1}{(3n+1)^3}-\frac{1}{(3n+2)^3}\right)\\ &=-\frac{1}{2}\operatorname*{Res}_{z=-1/3}\frac{\pi\cot(\pi z)}{(3z+1)^3}\\ &=-\frac{1}{108}\left(2\pi^3\cot(\pi z)\csc^2(\pi z)\right)\Bigg{|}_{z=-1/3}\\ &=\frac{2\pi^3}{81\sqrt{3}} \end{align}
Solution 2:
Let's actually do the integral using the keyhole contour. It may be time-consuming but it is not as bad as it looks.
We can begin by simplifying the integral using the substitution $u=x^2$:
$$I = \frac18 \int_0^{\infty} du \frac{\log^2{u}}{u^2+u+1} $$
Consider
$$\oint_C dz \frac{\log^3{z}}{z^2+z+1}$$
where $C$ is the keyhole contour, as pictured below.
The integral over the circular arcs vanish, and the contour integral is equal to
$$i \left ( -6 \pi \int_0^{\infty} dx \frac{\log^2{x}}{x^2+x+1} + 8 \pi^3 \int_0^{\infty} dx \frac{1}{x^2+x+1}\right ) + 12 \pi^2 \int_0^{\infty} dx \frac{\log{x}}{x^2+x+1}$$
We can easily show that
$$\int_0^{\infty} dx \frac{\log{x}}{x^2+x+1} = 0$$
by splitting up the integration interval into $[0,1]$ and $[1,\infty)$ and subbing $x=1/u$ in the latter subinterval.
Now, we can evaluate the other integral any way we want, but let's stay consistent within our chosen methodology, and evaluate the integral using the residue theorem, all the same. Let the poles of the denominator be $z_{\pm}$; here
$$z_+ = e^{i 2 \pi/3} \quad z_-=e^{i 4 \pi/3} $$
Then
$$\int_0^{\infty} dx \frac{1}{x^2+x+1} = - \left (\frac{\log{z_+}}{2 z_++1} +\frac{\log{z_-}}{2 z_-+1}\right ) = -\frac{i 2 \pi/3}{i \sqrt{3}} + \frac{i 4 \pi/3}{i \sqrt{3}} = \frac{2 \pi}{3 \sqrt{3}}$$
The contour integral is of course equal to $i 2 \pi$ times the sum of the residues at $z=z_{\pm}$. Thus we have
$$-3 \int_0^{\infty} dx \frac{\log^2{x}}{x^2+x+1} + 4 \pi^2 \frac{2 \pi}{3 \sqrt{3}} = \left (\frac{\log^3{z_+}}{2 z_++1} +\frac{\log^3{z_-}}{2 z_-+1}\right ) = \frac{56 \pi^3}{27 \sqrt{3}}$$
Thus, from above, we have
$$\int_0^{\infty} dx \frac{x \log^2{x}}{x^4+x^2+1} = \frac{2 \pi^3}{81 \sqrt{3}} $$
Solution 3:
$\newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle} \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack} \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,} \newcommand{\dd}{{\rm d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\dsc}[1]{\displaystyle{\color{red}{#1}}} \newcommand{\expo}[1]{\,{\rm e}^{#1}\,} \newcommand{\fermi}{\,{\rm f}} \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,} \newcommand{\half}{{1 \over 2}} \newcommand{\ic}{{\rm i}} \newcommand{\iff}{\Longleftrightarrow} \newcommand{\imp}{\Longrightarrow} \newcommand{\Li}[1]{\,{\rm Li}_{#1}} \newcommand{\norm}[1]{\left\vert\left\vert\, #1\,\right\vert\right\vert} \newcommand{\pars}[1]{\left(\, #1 \,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\pp}{{\cal P}} \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,} \newcommand{\sech}{\,{\rm sech}} \newcommand{\sgn}{\,{\rm sgn}} \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}} \newcommand{\ul}[1]{\underline{#1}} \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}$ $\ds{\int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x:\ {\large ?}}$.
\begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} =\int_{0}^{1}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x\ +\ \overbrace{\int_{1}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ^{\ds{\dsc{x}\ \mapsto\ \dsc{1 \over x}}} \\[5mm]&=2\ \overbrace{\int_{0}^{1}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ^{\ds{\dsc{x}\ \mapsto\ \dsc{x^{1/2}}}}\ =\ ={1 \over 4}\int_{0}^{1}{\ln^{2}\pars{x} \over x^2 + x + 1}\,\dd x =\ \overbrace{{1 \over 4}\int_{0}^{1}{\pars{1 - x}\ln^{2}\pars{x} \over 1 - x^{3}}\,\dd x} ^{\ds{\dsc{x}\ \mapsto\ \dsc{x^{1/3}}}} \\[5mm]&={1 \over 4}\int_{0}^{1}{\pars{1 - x^{1/3}}\ln^{2}\pars{x^{1/3}} \over 1 - x}\, {1 \over 3}\,x^{-2/3}\,\dd x ={1 \over 108}\int_{0}^{1}{\pars{x^{-2/3} - x^{-1/3}}\ln^{2}\pars{x} \over 1 - x}\, \,\dd x \\[5mm]&={1 \over 108}\lim_{\mu\ \to\ 0}\ \partiald[2]{}{\mu} \int_{0}^{1}{x^{\mu - 2/3} - x^{\mu - 1/3} \over 1 - x}\,\,\dd x \\[5mm]&={1 \over 108}\lim_{\mu\ \to\ 0}\ \partiald[2]{}{\mu}\pars{% \int_{0}^{1}{1 - x^{\mu - 1/3} \over 1 - x}\,\,\dd x -\int_{0}^{1}{1 - x^{\mu - 2/3} \over 1 - x}\,\,\dd x} \\[5mm]&={1 \over 108}\lim_{\mu\ \to\ 0}\ \partiald[2]{}{\mu}\bracks{% \Psi\pars{\mu + {2 \over 3}} - \Psi\pars{\mu + {1 \over 3}}} \end{align} where $\ds{\Psi}$ is the Digamma Function.
Then, \begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ={1 \over 108}\bracks{\Psi''\pars{2 \over 3} - \Psi''\pars{1 \over 3}} \end{align} With Euler Reflection Formula $\ds{\Psi''\pars{1 - z} =\Psi''\pars{z} + 2\pi^{3}\cot\pars{\pi z}\csc^{2}\pars{\pi z}}$: \begin{align}&\color{#66f}{\large% \int_{0}^{\infty}{x\ln^{2}\pars{x} \over x^4 + x^2 + 1}\,\dd x} ={1 \over 54}\,\pi^{3}\ \overbrace{\cot\pars{\pi \over 3}}^{\dsc{1 \over \root{3}}} \ \overbrace{\csc^{2}\pars{\pi \over 3}}^{\dsc{4 \over 3}} \ = \color{#66f}{\large{2\root{3} \over 243}\,\pi^{3}} \end{align}