Help with integrating $\int_0^{\infty} \frac{(\log x)^2}{x^2 + 1} \operatorname d\!x$ - contour integration?
Fleshing out Ragib's idea: we have the substitution $\,t\to -u+\pi i\Longrightarrow dt=-du,$ , so we put
$$f(t):=\frac{t^2e^t}{1+e^{2t}}\Longrightarrow$$
$$\Longrightarrow\int_{R+\pi i}^{-R+\pi i}f(t)\,dt=-\int_{-R}^R\frac{(u^2-2\pi iu-\pi^2)e^{-u+\pi i}}{1+e^{-2u+2\pi i}}\,du=$$
$$=\int_{-R}^R\frac{u^2e^{-u}}{1+e^{-2u}}du-2\pi i\int_{-R}^R\frac{ue^{-u}}{1+e^{-2u}}\,du-\pi^2\int_{-R}^R\frac{e^{-u}}{1+e^{-2u}}\,du$$
The first integral above is just like the one on the real axis (BTW, note the signs in front of the two last integrals, which come from the factor $\,e^{\pi i}=-1\,$).
The last integral is
$$\pi^2\int_{-R}^R\frac{d(e^{-u})}{1+e^{-2u}}=\left.\pi^2\arctan e^{-u}\right|_{-R}^R=$$
$$=\pi^2\left(\arctan e^{-R}-\arctan e^R\right)\xrightarrow [R\to\infty]{}\pi^2\left(0-\frac{\pi}{2}\right)=-\frac{\pi^3}{2}$$
The second integral above is zero as the integrand is just $\,\frac{\pi iu}{\cosh u}\,$ , which is an odd function...
Denoting our integral by $\, I \,$, we thus have that
$$2I-\frac{\pi ^3}{2}=-\frac{\pi^3}{4}\Longrightarrow I=\frac{\pi^3}{8}$$
Consider the integral
$$\oint_\Gamma \frac{\log^3{z}}{1+z^2}dz$$
where $\Gamma$ is a ''keyhole'' contour in the complex plane, about the positive real axis. This contour integral may be seen to vanish along the outer and inner circular contours about the origin, so the contour integral reduces
$$\int_0^{\infty} \frac{\log^3{x}-(\log{x}+i 2 \pi)^3}{1+x^2} dx\\ = -i 6 \pi \int_0^{\infty} \frac{\log^2{x}}{1+x^2}dx +12 \pi^2 \int_0^{\infty} \frac{\log x}{1+x^2}dx +i8\pi^3\int_0^{+\infty}\frac{1}{1+x^2}dx. $$ The last integral is easy: $$ \int_{0}^{+\infty}\frac{1}{1+x^2}dx=\tan^{-1}x \Big|_{0}^{+\infty }=\frac{\pi}{2}. $$
By the residue theorem, the contour integral is also equal to $i 2 \pi$ times the sum of the residues at the poles $z_+=i=e^{i \pi/2}$, and $z_-=-i=e^{+i3\pi/2}$, where the branch cut of the logarithm has been conveniently placed along the positive real axis. In this case, with the simple poles, we have the simple formulas
$$ \text{Res}\frac{\log^3{z}}{1+z^2}\Big|_{z=z+}=\frac{\log^3{z}}{2z}\Big|_{z=z+}=-\frac{\pi^3}{16} $$ $$ \text{Res}\frac{\log^3{z}}{1+z^2}\Big|_{z=z-}=\frac{\log^3{z}}{2z}\Big|_{z=z-}=+\frac{27\pi^3}{16}. $$
Thus we have that
$$ i2\pi \left(\frac{27\pi^3}{16}-\frac{\pi^3}{16}\right) =-i 6 \pi \int_0^{\infty} \frac{\log^2{x}}{1+x^2}dx +12 \pi^2 \int_0^{\infty} \frac{\log x}{1+x^2}dx +i4\pi^3 $$ or $$ -i\frac{3}{4}\pi^4 = -i 6 \pi \int_0^{\infty} \frac{\log^2{x}}{1+x^2}dx +12 \pi^2 \int_0^{\infty} \frac{\log x}{1+x^2}dx. $$ Finally, equating real and imaginary parts: $$ \int_0^{+\infty}\frac{\log x}{1+x^2}dx=0 $$ $$ \int_0^{+\infty}\frac{\log^2{x}}{1+x^2}dx=\frac{\pi^3}{8}. $$