<s>[INST] Evaluate the integral $\int_0^\infty \frac{x (\ln(x))^2}{x^4 + x^2 + 1}\text{ d}x$ What is the value of $\displaystyle\int_0^\infty \frac{x (\ln(x))^2}{x^4 + x^2 + 1}\text{ d}x$?
This is a question I came up with myself. It is not homework.
I constructed this example to make the following technique work:

 Integrate $\frac{z (\log(z))^3}{z^4 + z^2 + 1}$ along a "key-hole" contour. The argument can be made rigorous by splitting the contour into two parts, and using two different branch cuts for each part. Warning: This method is time-consuming and not for the faint-hearted

 [/INST] 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}} $$
</s>