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.
 A: It's easy to see that your integral is the same as
$$ I(a) = \int_0^{\infty} \frac{\log{(x^2+a^2)}}{x^2+b^2} \, dx $$
Now, we can do the case $a=0$ fairly easily, by setting $x=b^2/y$:
$$ \begin{align}
I(0) &= 2\int_0^{\infty} \frac{\log{x}}{x^2+b^2} \, dx \\
&= 2\int_0^{\infty} \frac{\log{(b^2/y)}}{b^2/y^2+b^2} \frac{b}{y^2} \, dy \\
&= 2\int_0^{\infty} \frac{2\log{b}-\log{y}}{y^2+b^2} \, dy \\
&= 4\log{b} \int_0^{\infty} \frac{dy}{y^2+b^2} -I(0),
\end{align} $$
so
$$ I(0) = \frac{\pi}{b}\log{b}. $$
To get from here to nonzero $a$, differentiate under the integral sign:
$$ I'(a) = \int_0^{\infty}\frac{\partial}{\partial a} \frac{\log{(x^2+a^2)}}{x^2+b^2} \, dx = \int_0^{\infty} \frac{2a \, dx}{(x^2+a^2)(x^2+b^2)} $$
But this is easy to calculate using partial fractions: we find
$$ I'(a) = \frac{2a\pi}{2(b^2-a^2)} \left( \frac{1}{a} - \frac{1}{b} \right) = \frac{\pi}{b(a+b)} $$
Now
$$ I(a) = I(0) + \int_0^{a} \frac{\pi}{b(A+b)}\, dA =  \frac{\pi}{b}(\log{(b+a)}-\log{b}+\log{b}) = \frac{\pi}{b}\log{(a+b)}, $$
as desired.

A complex analysis method will work in the same way as that given in this answer, although the pole is in a different place from the branch point in your case, rather than coincident.
A: 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$.
A: $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
 \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
 \newcommand{\dd}{\mathrm{d}}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
 \newcommand{\ic}{\mathrm{i}}
 \newcommand{\mc}[1]{\mathcal{#1}}
 \newcommand{\mrm}[1]{\mathrm{#1}}
 \newcommand{\pars}[1]{\left(\,{#1}\,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,}
 \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}}
 \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$

\begin{align}
&\bbox[15px,#ffd]{\int_{-\infty}^{\infty}{\ln\pars{\root{x^{2} + a^{2}}} \over x^{2} + b^{2}}\,\dd x} =
\Re\int_{-\infty}^{\infty}{\ln\pars{a + \ic x} \over x^{2} + b^{2}}\,\dd x
\\[5mm] 
\stackrel{\large x\ =\ \pars{a - s}\ic}{\large\vphantom{A}=}\,\,\,&
\Re\int_{\large a - \infty\ic}^{\large a + \infty\ic}
{\ln\pars{s} \over
\bracks{\pars{a - s}\ic + b\ic}\bracks{\pars{a - s}\ic - b\ic}}
\,\pars{-\ic}\,\dd s
\\[5mm] = &\
-\Im\int_{\large a - \infty\ic}^{\large a + \infty\ic}
{\ln\pars{s} \over
\bracks{s - \pars{a + b}}\bracks{s - \pars{a - b}}}\,\dd s
\\[5mm] = &\
-\Im\bracks{-2\pi\ic
{\ln\pars{a + b} \over \pars{a + b} - \pars{a - b}}} =
\bbx{{\pi \over b}\ln\pars{a + b}}
\end{align}
$\ds{\ln}$ is the logarithm principal branch. The contribution to the integral from the arc vanishes out
$\ds{\pars{~\mbox{its magnitude is}\ < {\pi\ln\pars{R} \over R}\ \mbox{as}\ R \to \infty~}}$ as the arc radius $\ds{R \to \infty}$.
