<s>[INST] Integrate $\frac{\log(x^2+4)}{(x^2+1)^2}$. 
Using residue calculus show that
$$\int_0^{\infty}\frac{\log(x^2+4)}{(x^2+1)^2}dx=\frac{\pi}2\log 3-\frac{\pi}6.$$

I was thinking of using some keyhole or semi-circular contour here. But the problem is apart from poles at $x=-i$ and $x=i$, the logarithm has singularities when $x=\pm 4i$.
I consider $C_R$, a semicircle contour oriented clockwise with radius $R$ centered at origin. The semicircle resides in the lower half plane, so that it encloses $x=-i$ as a pole.  I set
$$\int_{C_R} \frac{\log(2-ix)}{(x^2+1)^2}dx$$
But it seems like it leads to wrong answer.
 [/INST] Integrating
$$
\int_\gamma\frac{\log\left(z^2+4\right)}{\left(z^2+1\right)^2}\,\mathrm{d}z\tag1
$$
along the contour

gives $2\pi i$ times the residue at $z=i$.
The integral along the curved pieces vanish as the radius of the large semi-circle grows to $\infty$.
The integral along the downward line along the right side of the imaginary axis to $2i$ (in red) is
$$
-i\int_2^\infty\frac{\log\left(x^2-4\right)+\pi i}{\left(x^2-1\right)^2}\,\mathrm{d}x\tag2
$$
The integral along the upward line along the left side of the imaginary axis from $2i$ (in green) is
$$
i\int_2^\infty\frac{\log\left(x^2-4\right)-\pi i}{\left(x^2-1\right)^2}\,\mathrm{d}x\tag3
$$
For $z=ix$ and $x\gt2$, we have one of $\log\left(z^2+4\right)=\log\left(x^2-4\right)\pm\pi i$. Integrating $\frac1{z-2i}+\frac1{z+2i}$ clockwise around $2i$ decreases $\log\left(z^2+4\right)$ by $2\pi i$. Thus, on the right side of the branch cut, we have $\log\left(x^2-4\right)+\pi i$, and on the left side, we have $\log\left(x^2-4\right)-\pi i$.
The sum of the integrals in $(2)$ and $(3)$ is
$$
2\pi\int_2^\infty\frac1{(x^2-1)^2}\,\mathrm{d}x=\frac\pi6(4-3\log(3))\tag4
$$
The integral along the real axis (in blue) is
$$
2\int_0^\infty\frac{\log(x^2+4)}{(x^2+1)^2}\,\mathrm{d}x\tag5
$$
Furthermore,
$$
2\pi i\operatorname*{Res}_{z=i}\left(\frac{\log(z^2+4)}{(z^2+1)^2}\right)=\frac\pi6(2+3\log(3))\tag6
$$
Subtracting $(4)$ from $(6)$ and dividing by $2$ gives
$$
\int_0^\infty\frac{\log(x^2+4)}{(x^2+1)^2}\,\mathrm{d}x=\frac\pi2\log(3)-\frac\pi6\tag7
$$
</s>