<s>[INST] Contour integral for finding $\int_0^\infty \frac{\ln x}{(x+a)^2+b^2} \, dx$ I can't prove the following result:
$$\displaystyle\int_0^\infty \frac{\ln x}{(x+a)^2+b^2} \, dx=\frac{\ln \sqrt{a^2+b^2}}{b}\arctan\frac{b}{a} \text{ for all } a,b \in \mathbb{R}.$$
Well, I consider $\displaystyle\int_C \frac{\operatorname{Ln} z}{(z+a)^2+b^2} \, dz$ where $C$ is the usual contour for this kind of integral with logarithm (actually, I don't know if I'm right). So, assuming there is a simple pole inside the interior $C$, I apply the residue theorem as:
$$\int_{C}\frac{\operatorname{Ln} z}{(z+a)^2+b^2} \, dz\\=
2\pi i\left(\lim_{z\to-a+ib}\dfrac{(z+a-ib) \operatorname{Ln} z}{(z+a-ib)(z+a+ib)}\right)\\=
\frac{\pi}{b} \operatorname{Ln} (-a+ib)=\frac{\pi}{b}(\ln (\sqrt{a^2+b^2})+i\arg (-a+ib))$$
Now, I must consider estimations of integrals on each semicircle, however I have not idea how I can reach it.
Thanks for any hint.
 [/INST] An alternative, real-analytic solution by symmetry only.
$$ \int_{0}^{+\infty}\frac{\log x}{x^2+2ax+(a^2+b^2)}\stackrel{x\mapsto u\sqrt{a^2+b^2}}{=}\frac{1}{\sqrt{a^2+b^2}}\int_{0}^{+\infty}\frac{\log u+\log\sqrt{a^2+b^2}}{u^2+\frac{2a}{\sqrt{a^2+b^2}}u+1}\,du $$
and since the polynomial $p(u)=u^2+\frac{2a}{\sqrt{a^2+b^2}}u+1$ is quadratic and palindromic, $\int_{0}^{+\infty}\frac{\log u}{p(u)}\,du=0$ by the substitution $u\mapsto \frac{1}{u}$. This leaves us with the elementary integral
$$ \int_{0}^{+\infty}\frac{du}{u^2+2Du+1}=\int_{D}^{+\infty}\frac{du}{u^2+(1-D^2)}=\frac{1}{\sqrt{1-D^2}}\,\left(\frac{\pi}{2}-\arctan\frac{D}{\sqrt{1-D^2}}\right) $$
for any $D\in(-1,1)$. By letting $D=\frac{a}{\sqrt{a^2+b^2}}$ we get
$$\int_{0}^{+\infty}\frac{\log x}{(x+a)^2+b^2}=\frac{\log\sqrt{a^2+b^2}}{|b|}\left[\frac{\pi}{2}-\arctan\left(\frac{a}{|b|}\right)\right] $$
for any $b\neq 0$. If $b=0$ the LHS is convergent only for $a>0$, and in such a case it equals $\frac{\log a}{a}$.
</s>