Evaluate the integral$ \int_{-\infty}^{\infty}\frac{b\tan^{-1}\big(\frac{\sqrt{x^2+a^2}}{b}\big)}{(x^2+b^2)(\sqrt{x^2+a^2})}\,dx$. I am attempting to evaluate 
$$\int_{-\infty}^{\infty}\dfrac{b\tan^{-1}\Big(\dfrac{\sqrt{x^2+a^2}}{b}\Big)}{(x^2+b^2)(\sqrt{x^2+a^2})}\,dx. $$
I have tried using the residue formula to calculate the residues at $\pm ib,\pm ia,$ but it got messy very quickly. Then I tried to use a trigonometric substitution $x=a\tan(\theta)$; $dx=a\sec^{2}(\theta)\,d\theta$ which led me to the integral $$\int_{-\infty}^{\infty}\dfrac{b\tan^{-1}\Big(\dfrac{a\sec(\theta)}{b}\Big)\sec(\theta)}{(a^2\tan^{2}(\theta)+b^2)}\,d\theta.$$ The bounds for this integral seem incorrect, but I am more worried about the actual expression before I deal with the bounds, which may have to be changed into a double integral where $0\leq\theta\leq2\pi$ and the second bound would range from $-\infty$ to $\infty$. I am wondering if there is some kind of substitution I have missed, but I have hit the wall. The OP of this problem said there were cases that would come into play, but when I asked him whether or not those cases arose from $b<0$ and $b>0$ he told me they did not. The cases most likely arise from whether $a$ and $b$ are positive or negative, because the case where $b=0$ is trivial, and in the case where $a=0$ I used wolframalpha and the integral evaluates to $\dfrac{\pi\ln(2)\lvert b \rvert}{b^2}$ for $\Im(b)=0 \land \Re(b)\neq0.$ Contour integration may be necessary. I am stuck on this problem and I would greatly appreciate the help. Thank you for your time. 
 A: In the following we shall assume that $a$, $b$, and $c$ are real valued and that $a>b>0$.
Let $F(c)$ be represented by the integral
$$F(c)=b\int_{-\infty}^\infty \frac{\arctan\left(\frac{\sqrt{x^2+a^2}}{c}\right)}{(x^2+b^2)\sqrt{x^2+a^2}}\,dx\tag 1$$
Differentiating $(1)$ reveals
$$\begin{align}
F'(c)&=-b\int_{-\infty}^\infty \frac{1}{(x^2+b^2)(x^2+a^2+c^2)}\,dx\\\\
&=-\frac{\pi}{c^2+a^2+b\sqrt{c^2+a^2}}\tag2
\end{align}$$
Integrating $(2)$ and using $\lim_{c\to \infty}F(c)=0$, we find that
$$\begin{align}
F(c)&=\pi\,\left(\frac{\arctan\left(\frac{bc}{\sqrt{a^2-b^2}\sqrt{a^2+c^2}}\right)-\arctan\left(\frac{b}{\sqrt{a^2-b^2}}\right)+\pi/2-\arctan\left(\frac{c}{\sqrt{a^2-b^2}}\right)}{\sqrt{a^2-b^2}}\right)
\end{align}$$
Setting $c=b$ yields the coveted result
$$\int_{-\infty}^\infty \frac{b\arctan\left(\frac{\sqrt{x^2+a^2}}{b}\right)}{(x^2+b^2)\sqrt{x^2+a^2}}\,dx=\pi\,\left(\frac{\arctan\left(\frac{b^2}{\sqrt{a^2-b^2}\sqrt{a^2+b^2}}\right)+\pi/2-2\arctan\left(\frac{b}{\sqrt{a^2-b^2}}\right)}{\sqrt{a^2-b^2}}\right)$$
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}$

Note that
  $\ds{{\arctan\pars{\xi} \over \xi} =
\int_{1}^{\infty}{\dd t \over t^{2} + \xi^{2}}}$.

\begin{align}
&\bbox[#ffd,10px]{\ds{\int_{-\infty}^{\infty}{b\arctan\pars{\root{x^{2} + a^{2}}/b} \over \pars{x^{2} + b^{2}}\root{x^{2} + a^{2}}}\,\dd x}} =
2\int_{0}^{\infty}{\arctan\pars{\root{x^{2} + a^{2}}/\verts{b}} \over \root{x^{2} + a^{2}}/\verts{b}}\,{\dd x \over x^{2} + b^{2}}
\\[5mm] = &\
2\int_{0}^{\infty}\int_{1}^{\infty}{\dd t \over
t^{2} + \pars{x^{2} + a^{2}}/b^{2}}\,{\dd x \over x^{2} + b^{2}} =
2b^{2}\int_{1}^{\infty}\int_{0}^{\infty}{\dd x \over
\pars{x^{2} + b^{2}t^{2} + a^{2}}\pars{x^{2} + b^{2}}}\,\dd t
\\[5mm] = &\
{2 \over \verts{b}}\int_{1}^{\infty}\int_{0}^{\infty}{\dd x \over
\pars{x^{2} + t^{2} + \mu^{2}}\pars{x^{2} + 1}}\,\dd t\,,
\qquad\qquad\qquad\mu \equiv {a \over b}
\end{align}

\begin{align}
&\bbox[#ffd,10px]{\ds{\int_{-\infty}^{\infty}{b\arctan\pars{\root{x^{2} + a^{2}}/b} \over \pars{x^{2} + b^{2}}\root{x^{2} + a^{2}}}\,\dd x}}
\\[5mm] = &\
{2 \over \verts{b}}\int_{1}^{\infty}{1 \over t^{2} + \mu^{2} - 1}
\int_{0}^{\infty}{\dd x \over x^{2} + 1}\,\dd t -
{2 \over \verts{b}}\int_{1}^{\infty}{1 \over t^{2} + \mu^{2} - 1}
\int_{0}^{\infty}{\dd x \over x^{2} + t^{2} + \mu^{2}}\,\dd t
\\[5mm] = &\
{\pi \over \verts{b}}\int_{1}^{\infty}{\dd t \over t^{2} + \mu^{2} - 1} -
{\pi \over \verts{b}}\int_{1}^{\infty}{\dd t \over
\pars{t^{2} + \mu^{2} - 1}\root{t^{2} + \mu^{2}}}
\\[5mm] = &\
\bbox[#ffe,10px,border:1px groove navy]{{\pi \over \verts{b}}\bracks{{\arctan\pars{\root{\mu^{2} - 1}} -
\mrm{arccot}\pars{\root{\mu^{2} - 1}} +
\mrm{arccot}\pars{\root{\mu^{4} - 1}} \over \root{\mu^{2} - 1}}}}\,,
\quad\mu \equiv {a \over b}
\end{align}


The second integral was evaluated as follows

\begin{align}
&\bbox[10px,#ffd]{\ds{\int_{1}^{\infty}{\dd t \over
\pars{t^{2} + \mu^{2} - 1}\root{t^{2} + \mu^{2}}}}}
\,\,\,\stackrel{t\ \mapsto\ 1/t}{=}\,\,\,
\int_{0}^{1}{t\,\dd t \over
\bracks{\pars{\mu^{2} - 1}t^{2} + 1}\root{1 + \mu^{2}t^{2}}}
\\[5mm] \stackrel{t^{2}\ \mapsto\ t}{=}\,\,\, &\
{1 \over 2}\int_{0}^{1}{\dd t \over
\bracks{\pars{\mu^{2} - 1}t + 1}\root{1 + \mu^{2}t}}
\,\,\,\stackrel{\root{1 + \mu^{2}t}\ \mapsto\ t}{=}\,\,\,
\int_{1}^{\root{1 + \mu^{2}}}{\dd t \over \pars{\mu^{2} - 1}t^{2} + 1}
\\[5mm] = &\
{\mrm{arccot}\pars{\root{\mu^{2} - 1}} -
\mrm{arccot}\pars{\root{\mu^{4} - 1}} \over \root{\mu^{2} - 1}}
\end{align}
A: We will use Mark Viola’s derivations to account for the case when $\lvert\,a\,\rvert< \lvert\,b\,\rvert$. 
Integrating $(2)$ (See Mark Viola's answer above) and using $\lim_{c\to \infty}F(c)=0$, we find that
$$\begin{align}
F(c)&=\pi\,\left(\frac{\arctan\left(\frac{bc}{\sqrt{a^2-b^2}\sqrt{a^2+c^2}}\right)-\arctan\left(\frac{b}{\sqrt{a^2-b^2}}\right)+\pi/2-\arctan\left(\frac{c}{\sqrt{a^2-b^2}}\right)}{\sqrt{a^2-b^2}}\right)
\end{align}.$$
Now we will account for our case’s assumption and arrive at 
$$\begin{align}
F(c)&=\pi\,\left(\frac{-i\tanh^{-1}\left(\frac{bc}{\sqrt{b^2-a^2}\sqrt{a^2+c^2}}\right)+i\tanh^{-1}\left(\frac{b}{\sqrt{b^2-a^2}}\right)+\pi/2+i\tanh^{-1}\left(\frac{c}{\sqrt{b^2-a^2}}\right)}{i\sqrt{b^2-a^2}}\right) \\
&=\pi\,\left(\frac{-\tanh^{-1}\left(\frac{bc}{\sqrt{b^2-a^2}\sqrt{a^2+c^2}}\right)+\tanh^{-1}\left(\frac{b}{\sqrt{b^2-a^2}}\right)-i\pi/2+\tanh^{-1}\left(\frac{c}{\sqrt{b^2-a^2}}\right)}{\sqrt{b^2-a^2}}\right)
\end{align}.$$
We replace $c=b$ to obtain our result 
$$\int_{-\infty}^\infty \frac{b\arctan\left(\frac{\sqrt{x^2+a^2}}{b}\right)}{(x^2+b^2)\sqrt{x^2+a^2}}\,dx=\\\pi\,\left(\frac{-\tanh^{-1}\left(\frac{b^2}{\sqrt{b^2-a^2}\sqrt{a^2+b^2}}\right)-i\pi/2+2\tanh^{-1}\left(\frac{b}{\sqrt{b^2-a^2}}\right)}{\sqrt{b^2-a^2}}\right).$$
