Keyhole contour for $\frac{(\log{x})^2}{1+x^3}$ I am trying to evaluate the integral
$\displaystyle \int_0^{\infty}\frac{\log x}{x^3+1}dx$
and I was trying the keyhole contour with $\displaystyle f(z)=\frac{(\log z)^2}{z^3+1}$
The large circular contour $\gamma_R:t\mapsto Re^{it}$ and the small circular contour $\gamma_{\epsilon}:t\to \epsilon e^{it}$ around $0$ both have integrals which tend to $0$ as we let $R\to \infty$ and $\epsilon \to 0$. 
The three residues at $z=-1, e^{i\pi/3}, e^{-i\pi/3}$ are 
$\displaystyle \frac{(\log i)^2}{3i^2}=-\frac{\pi^2}{3}, \frac{(\log e^{i\pi/3})^2}{3(e^{i\pi/3})^2}=-\frac{\pi^2}{27}e^{-2i\pi/3}$ and $\displaystyle -\frac{\pi^2}{27}e^{2i\pi/3}$
The path above the branch (i.e. the positive real axes) converges to $\displaystyle \int_0^{\infty}\frac{(\log x)^2}{x^3+1}dx$ and the path below the branch $\displaystyle -\int_0^{\infty}\frac{(\log x+2i\pi)^2}{x^3+1}dx$
So when we add everything up we get
$\displaystyle -\int_0^{\infty}\frac{4i\pi\log x-4\pi^2}{x^3+1}dx=2i\pi[-\pi^2/3-\pi^2/27(e^{-2\pi i/3}+e^{2\pi i/3})]=2i\pi\left(-\frac{\pi^2}{3}+\frac{\pi^2}{27}\right)$
By taking the imaginary part, this would (incorrectly) seem to imply that 
$\displaystyle 4\pi\int_0^{\infty}\frac{\log x}{x^3+1}dx=-2\pi\frac{8\pi^2}{27}$
$\displaystyle \int_0^{\infty}\frac{\log x}{x^3+1}dx=\frac{4\pi^2}{27}$
(The real answer is $\frac{2\pi^2}{27}$)
This also (again incorrectly) implies that 
$\displaystyle \int_0^{\infty}\frac{1}{x^3+1}dx=0$
(The real answer is $\frac{2\pi}{3\sqrt{3}}$)
as the real part is $0$ on the right hand side. 
I have verified that these answers are in fact wrong. 
I appreciate that there are alternative contours to evaluate this integral but I would like to know what I missed in this particular computation. 
 A: Your problem is that the pole at $z=e^{-i \pi/3}$ should be $z=e^{i 5 \pi/3}$, because you chose your branch cut such that $\arg{z} \in [0,2 \pi)$.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\on}[1]{\operatorname{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

*

*Hereafter, $\ds{\ln}$ is the logarithm principal branch and $\ds{\cal C}$ is a key-hole contour which "takes care" of the above mentioned branch-cut.

*Contributions from the big arc and the smal arc around $\ds{z = 0}$ vanish out in the,respectively, radius $\ds{\to \infty}$ and radius $\ds{\to 0^{+}}$.

*Poles of the integrand are, $\underline{according}$ to the above mentioned branch-cut, are
$\ds{r = \exp\pars{\pm{2\pi \over 3}\,\ic}}$.


Namely,
\begin{align}
&\bbox[5mm,#ffd]{\oint_{\cal C}{\ln^{2}\pars{z} \over
z^{3} - 1}\,\dd z}
\\ = &\
2\pi\ic\sum_{r = \exp\pars{\pm 2\pi\ic/3}}\,\,\,\,
\lim_{z \to r}\bracks{\pars{z - r}\,{\ln^{2}\pars{z} \over z^{3} - 1}}
\\[5mm] = &\
2\pi\ic\sum_{r = \exp\pars{\pm 2\pi\ic/3}}\,\,\,\,
\bracks{-4\pi^{2}/9 \over 3r^{2}} =
-\,{8\pi^{3} \over 27}\,\ic
\sum_{r = \expo{\pm 2\pi\ic/3}}\,\,\,\,r
\\[5mm] = &\
-\,{16\pi^{3} \over 27}\,\ic\cos\pars{2\pi \over 3} =
{8\pi^{3} \over 27}\,\ic\label{1}\tag{1}
\end{align}

\begin{align}
&\bbox[5mm,#ffd]{\oint_{\cal C}{\ln^{2}\pars{z} \over
z^{3} - 1}\,\dd z}
\\ = &\
\int_{-\infty}^{0}{\bracks{\ln\pars{-x} + \ic\pi}^{2} \over
x^{3} - 1}\,\dd x +
\int_{0}^{-\infty}{\bracks{\ln\pars{-x} - \ic\pi}^{2} \over
x^{3} - 1}\,\dd x
\\[3mm] = &\
-\int_{0}^{\infty}{\bracks{\ln\pars{x} + \ic\pi}^{2} \over
x^{3} + 1}\,\dd x +
\int_{0}^{\infty}{\bracks{\ln\pars{x} - \ic\pi}^{2} \over
x^{3} + 1}\,\dd x
\\[5mm] = &
-4\pi\ic\int_{0}^{\infty}{\ln\pars{x} \over x^{3} + 1}
\,\dd x\label{2}\tag{2}
\end{align}

(\ref{1}) and (\ref{2}) yield:
\begin{align}
&\int_{0}^{\infty}{\ln\pars{x} \over x^{3} + 1}
\,\dd x =
{8\pi^{3}\,\ic\,/27 \over -4\pi\ic} =
\bbx{-\,{2\pi^{2} \over 27}} \approx -0.7311 \\ &
\end{align}
