Since you want to use the residue theorem, I'll provide the contour-analysis based approach using a keyhole contour (the coolest way of evaluating this integral).
A nice tip you can use when you want to use a residue-based approach and see that your function has a logarithm in the numerator is to consider the same function with the logarithm raised to an extra power of one. In this case, the power is two so we use the function$$g(z)=f(z)\log^3z\qquad\qquad f(z)=\frac 1{(1+z)^2}$$And the contour we integrate, pictured below, is a keyhole contour.

A keyhole contour allows us to derive the integral by exploiting the logarithm's multivalued behavior. In this case, we define the argument above the positive real axis to be zero and below to be $2\pi$. I.e $z=x$ above and $z=xe^{2\pi i}$ below the real axis.
To evaluate the contour integral, we first parametrize about each piece of the contour. Let the larger and smaller circle have a radius of $R$ and $\epsilon$ respectively and the arcs $\Gamma_{R}$ and $\gamma_{\epsilon}$ respectively. Now define the complex function$$f(z)=\frac 1{(1+z)^2}$$
and integrate it about the contour to get$$\begin{multline}\oint\limits_{\mathrm C}dz\, f(z)\log^3z=\int\limits_{\epsilon}^{R}dx\, f(x)\log^3x+\int\limits_{\Gamma_{R}}dz\, f(z)\log^3z\\-\int\limits_{\epsilon}^{R}dx\, f(x)(\log|x|+2\pi i)^3+\int\limits_{\gamma_{\epsilon}}dz\, f(z)\log^3z\end{multline}$$
As $R\to\infty$ and $\epsilon\to0$, the second and fourth integrals vanish, leaving us with$$\oint\limits_{\mathrm C}dz\, f(z)\log^3z=-12\pi^2\int\limits_0^{\infty}dx\, f(x)\log x-6\pi^2 i\int\limits_0^{\infty}dx\, f(x)\log^2x+8\pi^2i\int\limits_0^{\infty}dx\, f(x)$$Where the middle integral is the one we want. The residue at $z=-1$ is$$\operatorname*{Res}_{z\, =\, -1}\frac {\log^3z}{(1+z)^2}=\lim\limits_{z\to -1}\frac {d}{dz}\,\frac {(z+1)^2\log^3z}{(z+1)^2}=3\pi^2$$So the contour integral is simply $2\pi i$ times that. Taking the imaginary part gives$$6\pi^3=-6\pi\int\limits_0^{\infty}dx\, f(x)\log^2x+8\pi^3\underbrace{\int\limits_0^{\infty}dx\, f(x)}_1$$Isolating and dividing both sides by $-6\pi$, it's clear that$$\int\limits_0^{\infty}dx\,\frac {\log^2x}{(1+x)^2}\color{blue}{=\frac {\pi^2}3}$$