Improper integral of $\frac{\log\left(\sqrt{x^2+a^2}\right)}{x^2+b^2}$ Show that $$\int_{-\infty}^\infty \frac{\log\left(\sqrt{x^2+a^2}\right)}{x^2+b^2}\,dx = \frac{\pi}{b}\log\left(a+b\right)$$
for $a,b>0\in\mathbb{R}$. I stumbled on this answer empirically, but I'm not sure how to solve it directly.

Suppose $a \gt b$ for now.  Consider the contour integral in the complex plane
$$\oint_C dz \frac{\log{\left ( z^2+a^2 \right )}}{z^2+b^2} $$
where $C$ is a semicircle of radius $R$ in the upper half-plane with a detour down and up the imaginary axis about the branch point $z=i a$.  In the limit as $R \to \infty$, the contour integral is equal to
$$\int_{-\infty}^{\infty} dx \frac{\log{\left ( x^2+a^2 \right )}}{x^2+b^2} + i \int_{\infty}^a dy \frac{\log{\left ( y^2-a^2 \right )}+i \pi}{b^2-y^2} + i \int_a^{\infty} dy \frac{\log{\left ( y^2-a^2 \right )}-i \pi}{b^2-y^2}$$
Note that the log terms in the latter two integrals vanish.  Now, the contour integral is also equal to the residue of the pole of the integrand at $z=i b$.  Thus
$$\int_{-\infty}^{\infty} dx \frac{\log{\left ( x^2+a^2 \right )}}{x^2+b^2} - 2 \pi \int_a^{\infty} \frac{dy}{y^2-b^2} = i 2 \pi \frac{\log{\left ( a^2-b^2 \right )}}{i 2 b} $$
Accordingly, after doing out that second integral and performing a little algebra, we get...

$$\frac12 \int_{-\infty}^{\infty} dx \frac{\log{\left ( x^2+a^2 \right )}}{x^2+b^2} = \frac{\pi}{b} \log{\left ( a+b \right )} $$

ADDENDUM
For $a \lt b$, the answer is the same as above but the contour is altered.  This time, the contour $C$ must detour about the pole at $z=i b$ along each side of the branch cut with a semicircle of radius $\epsilon$. The contour integral is this equal to
$$\int_{-\infty}^{\infty} dx \frac{\log{\left ( x^2+a^2 \right )}}{x^2+b^2} + i PV \int_{\infty}^a dy \frac{\log{\left ( y^2-a^2 \right )}+i \pi}{b^2-y^2} + i PV \int_a^{\infty} dy \frac{\log{\left ( y^2-a^2 \right )}-i \pi}{b^2-y^2} \\ + i \epsilon \int_{\pi/2}^{-\pi/2} d\phi \, e^{i \phi} \frac{\log{\left [- \left (i b + \epsilon e^{i \phi} \right )^2-a^2 \right ]}+i \pi}{\left (i b + \epsilon e^{i \phi} \right )^2+b^2}+ i \epsilon \int_{3 \pi/2}^{\pi/2} d\phi \, e^{i \phi} \frac{\log{\left [ -\left (i b + \epsilon e^{i \phi} \right )^2-a^2 \right ]}-i \pi}{\left (i b + \epsilon e^{i \phi} \right )^2+b^2}$$
Note that the sum of the two final integrals - the pieces that go around the pole - is equal to the residue of the pole at $z=i b$ in the limit as $\epsilon \to 0$.  The $\pm i \pi$ pieces cancel.  Also note that the principal value integrals are the same as the corresponding integrals above for $a \gt b$.  Thus, the result for $a \lt b$ is the same as that for $a \gt b$.
