Solve this integral using Residue Theorem I am trying to find 
$$\int_{0}^{\infty} {\frac{\ln(x)}{(x+1)^3}}dx$$
Using the residue formula. 
I am mainly having a hard time finding a contour that works, since we must include the pole of order three at $x=-1$. 
I have tried a partial, indented circle that goes from $\theta = 0$ to $4\pi/3$ and a $3/4$ circle as well, but in both cases, if $\gamma_3(t) = te^{i\theta}, t \in (R,0)$ for a fixed $\theta$ in the third quadrant, we are left with the real part of the integral, as well as a complex integral that is just as difficult to solve. 
The residue I calculated is:
$$res_{-1}f(z) = \lim_{z \rightarrow -1}\frac{1}{3!} \frac{d^2}{dz^2} (z+1)^3 \frac{\ln{z}}{(1+z)^3}$$ $$=\frac{1}{2}* \frac{-1}{-1^2} = \frac{-1}{2}$$
So that means the entire complex integral should be $2\pi i* \frac{-1}{2} = -\pi i$... 
I had another idea for a contour that catches the pole: we have 
$$\gamma_1(t) = t, t \in (\epsilon, R)$$
$$\gamma_2(t) = Re^{it}, t\in (0, \pi/2)$$
$$\gamma_3(t) = e^{it} -1, t \in (\pi, 2\pi - \epsilon)$$
$$\gamma_4(t) = $$ the little tiny circle to complete the contour. 
But this one, for $\gamma_3$ gives us a weird integral: 
$$\int_{\pi}^{2\pi - \epsilon}\frac{\ln{e^{it} - 1}}{(e^{it} - 1 +1)^3}(ie^{it})$$
Which looks a little better, but I'm not sure how to hande the log function in this case, and it doesn't look promising. Any help would be appreciated. 
 A: HINT:
Analyze the contour integral $\oint_C \frac{\log^2(z)}{(z+1)^3}\,dz$ where $C$ is the classical keyhole contour with a branch cut along the non-negative real axis. 
Use the residue theorem to evaluate this closed-contour integral (there is a third order pole at $z=-1$).
Finally, note that $\log^2(z)=\log^2(x)$ on that part of the branch cut in Quadrant I and $\log^2(z)=(\log(x)+2\pi i)^2$ on that part of the branch cut in Quadrant IV.
A: The contour we need to use for this question is a basic keyhole contour

First, parametrize about the contour in four different areas. Let the smaller circle have a radius of $\epsilon$ and the larger circle have a radius of $R$. Furthermore, denote the arcs of the larger circle and smaller circle as $\Gamma_R$ and $\gamma_{\epsilon}$ respectively. Considering the function
$$f(z)=\frac {1}{(z+1)^3}$$
We have
$$\begin{multline}\oint\limits_{\mathrm C}dz\, f(z)\log^2z=\int\limits_{\epsilon}^{R}dx\, f(x)\log^2x+\int\limits_{\Gamma_{R}}dz\, f(z)\log^2z\\-\int\limits_{\epsilon}^{R}dx\, f(x)(\log|x|+2\pi i)^2+\int\limits_{\gamma_{\epsilon}}dz\, f(z)\log^2z\end{multline}$$
As $R\to\infty$ and $\epsilon\to0$, the integrals around the arc vanish leaving us with
$$\oint\limits_{\mathrm C}dz\, f(z)\log^2z=-4\pi i\int\limits_0^{\infty}dx\, f(x)\log x+4\pi^2\int\limits_0^{\infty}dx\, f(x)$$
All you have to do left is calculate the residue, multiply that by $2\pi i$, and divide the imaginary part by $-4\pi$ to get the answer to your integral.
I'll leave the rest of the work up to you.
