Integrate the function $$f(z) = \frac{e^{iz}}{z(1+z)} $$ around the contour $$[r, R] \cup Re^{i[0,\pi/2]} \cup [iR, ir] \cup re^{i[\pi/2,0]}. $$
$Re^{i[0,\pi/2]}$ is large quarter-circle in the first quadrant of the complex plane of radius $R$, and $re^{i[\pi/2,0]} $ is a small quarter-circle in the first quadrant of the complex plane of radius $r$.
Let's call the small quarter-circle $C_{r}$.
Letting $R \to \infty$, the integral vanishes on the large quarter-circle by Jordan's lemma.
So we have $$\int_{r}^{\infty} \frac{e^{ix}}{x(1+x)} \, \mathrm dx - \int_{r}^{\infty} \frac{e^{-x}}{x(1+ix)} \, \mathrm dx + \int_{C_{r}} f(z) \, \mathrm dz= 0.$$
Since $f(z)$ is a simple pole and $C_{r}$ is a clockwise-oriented quarter-circle, $\int_{C_{r}} f(z) \, \mathrm dz$ goes to $-\frac{i \pi}{2} \operatorname*{Res}_{z = 0}f(z) = -\frac{i \pi}{2}$ as $r \to 0$.
Then equating the imaginary parts on both sides of equation, we have $$ \begin{align} \int_{0}^{\infty} \frac{\sin (x)}{x(1+x)} \, \mathrm dx &= - \int_{0}^{\infty} \frac{e^{-x}}{1+x^{2}} \, \mathrm dx + \frac{\pi}{2} \\ &\overset{ibp}{=} - \int_{0}^{\infty} \arctan(x) e^{-x} \, \mathrm dx + \frac{\pi}{2} \\ &= - \int_{0}^{\infty} \arctan(x) e^{-x} \, \mathrm dx + \frac{\pi}{2} \int_{0}^{\infty} e^{-x} \, \mathrm dx \\ &= \int_{0}^{\infty} \left(\frac{\pi}{2} - \arctan(x) \right)e^{-x} \, \mathrm dx \end{align}$$
If we equate the real parts on both sides of the equation, we get $$\int_{0}^{\infty} \left( \frac{\cos(x)}{1+x} - \frac{e^{-x}}{1+x^{2}} \right) \frac{\mathrm dx}{x} = 0. $$