Prove $\int_{- \infty}^{\infty} \frac{\mathrm{dx}}{({x}^{2} + {b}^{2}) {({x}^{2} + {a}^{2})}^{2}} = \frac{\pi (2 a + b)}{2 {a}^{3} b {(a + b)}^{2}}$ I am in chapter 6 of Whittaker and Watson, and I am currently confused attempting to find the mistake I made in computing the following integral. The problem asks me to prove the following relationship
\begin{align}\int_{- \infty}^{\infty} \frac{\mathrm{dx}}{\left({x}^{2} + {b}^{2}\right) {\left({x}^{2} + {a}^{2}\right)}^{2}} = \frac{\pi \left(2 a + b\right)}{2 {a}^{3} b {\left(a + b\right)}^{2}}\end{align}
Attempted solution: I thought it best to try an evaluate this integral using Jordan's lemma. I already feel comfortable with my proof for demonstrating that the integral along a semicircle in the upper half plane will collapse to $0$ as its radius trends towards infinity. For simplicity, I am examining the case $a > 0$ and $b > 0$. (I believe that the case when one of them is zero could be solved by producing another semicircular domain around the real axis.)
I assert
\begin{align}
 I & = \int_{- \infty}^{\infty} \frac{\mathrm{dx}}{\left({x}^{2} + {b}^{2}\right) {\left({x}^{2} + {a}^{2}\right)}^{2}} \\
 & = \int_{- \infty}^{\infty} \frac{\mathrm{dx}}{\left(x - i b\right) \left(x + i b\right) {\left(x - i a\right)}^{2} {\left(x + i a\right)}^{2}} \\
 & = \int_{C} \frac{\mathrm{dz}}{\left(z - i b\right) \left(z + i b\right) {\left(z - i a\right)}^{2} {\left(z + i a\right)}^{2}} \\
\end{align}
where $C$ is a semicircular contour in the upper half plane formed by the line from $- R$ to $R$ and a semicircle $\Gamma$.
For concision, I define
\begin{align}
 f \left(z\right) = \frac{1}{\left(z - i b\right) \left(z + i b\right) {\left(z - i a\right)}^{2} {\left(z + i a\right)}^{2}} \\
\end{align}
such that
\begin{align}
 \int_{C} f \left(z\right) \mathrm{dz} = 2 \pi i \left[{\text{Res}}_{z = i b} f \left(z\right) + {\text{Res}}_{z = i a} f \left(z\right)\right] \\
\end{align}
The point $i b$ is an order $1$ pole, so I use the formula
\begin{align}
 {\text{Res}}_{z = i b} f \left(z\right) & = \lim_{z \to i b} \left(z - i b\right) f \left(z\right) \\
 & = \lim_{z \to i b} \frac{1}{\left(z + i b\right) {\left({z}^{2} + {a}^{2}\right)}^{2}} \\
 & = \frac{1}{2 i b \left({a}^{2} - {b}^{2}\right)} \\
\end{align}
Likewise, $i a$ is an order $2$ pole, so
\begin{align}
 {\text{Res}}_{z = i a} f \left(z\right) & = \lim_{z \to i a} \frac{d}{\mathrm{dz}} \left({\left(z - i a\right)}^{2} f \left(z\right)\right) \\
 & = \lim_{z \to i a} \frac{d}{\mathrm{dz}} \left(\frac{1}{\left({z}^{2} + {b}^{2}\right) {\left(z + i a\right)}^{2}}\right) \\
 & = \lim_{z \to i a} \frac{- 2 z {\left(z + i a\right)}^{2} - 2 \left({z}^{2} + {b}^{2}\right) \left(z + i a\right)}{{\left({z}^{2} + {b}^{2}\right)}^{2} {\left(z + i a\right)}^{2}} \\
 & = \frac{8 i {a}^{3} - 4 i a {b}^{2} + 4 i {a}^{3}}{\left({b}^{2} - {a}^{2}\right) \left(- 4 {a}^{2}\right)} \\
\end{align}
Then,
\begin{align}
 I & = \frac{2 \pi i}{{\left({a}^{2} - {b}^{2}\right)}^{2}} \left(\frac{1}{2 i b} + \frac{8 {a}^{3} i - 4 i a {b}^{2} + 4 i {a}^{3}}{\left(- 4 {a}^{2}\right)}\right) \\
 & = \pi \left(\frac{{a}^{2} + 4 {a}^{3} b - 2 a {b}^{3} + 2 b {a}^{3}}{{a}^{2} b {\left({a}^{2} - {b}^{2}\right)}^{2}}\right) \\
\end{align}
However, I believe that I have made a mistake as using the identity, $\left({a}^{2} - {b}^{2}\right) = \left(a + b\right) \left(a - b\right)$ and multiplying by $\frac{a}{a}$, I find
\begin{align}
 I = \pi \left(\frac{{a}^{4} + 4 {a}^{4} b - 2 {a}^{2} {b}^{3} + 2 b {a}^{4}}{{a}^{2} b {\left({a}^{2} - {b}^{2}\right)}^{2}}\right) \\
\end{align}
with the contradiction that
\begin{align}
 \left(2 a + b\right) {\left(a - b\right)}^{2} & = \left(2 a + b\right) \left({a}^{2} + {b}^{2} - 2 a b\right) \\
 & = 2 {a}^{3} + 2 a {b}^{2} - 4 {a}^{2} b + b {a}^{2} + {b}^{3} - 2 a {b}^{2} \\
 & = 2 {a}^{3} - 3 {a}^{2} b + {b}^{3} \\
 & \ne {a}^{4} + 4 {a}^{4} b - 2 {a}^{2} {b}^{3} + 2 b {a}^{4} \\
\end{align}
Question: Where is the mistake in my above reasoning? Is my computation of the residues incorrect? (I hope that it was not a simple algebraic oversight given how long it took to type my question.)
 A: Actually,\begin{align}\lim_{z\to ai}\frac{\mathrm d}{\mathrm dz}\frac1{(z^2+b^2)(z+ai)^2}&=\lim_{z\to ai}\frac{-2z(z+ai)^2-2(z^2+b^2)(z+ai)}{(z^2+b^2)^2(z+ai)^{\color{red}4}}\\&=\frac{i \left(3 a^2-b^2\right)}{4 a^3 (a-b)^2 (a+b)^2}.\end{align}
A: Without residues but partial fractions, the integrand is
$$-\frac{i}{2 b \left(b^2-a^2\right)^2 (z-i b)}+\frac{i}{2 b \left(b^2-a^2\right)^2
   (z+i b)}+$$ $$\frac{1}{4 a^2 \left(a^2-b^2\right) (z-i a)^2}+\frac{1}{4 a^2
   \left(a^2-b^2\right) (z+i a)^2}+$$ $$\frac{i \left(3 a^2-b^2\right)}{4 a^3
   \left(a^2-b^2\right)^2 (z-i a)}-\frac{i \left(3 a^2-b^2\right)}{4 a^3
   \left(a^2-b^2\right)^2 (z+i a)}$$
Integrated between $-t$ and $+t$, it gives
$$\frac{a b t \left(b^2-a^2\right)+\left(a^2+t^2\right) \left(2 a^3 \tan
   ^{-1}\left(\frac{t}{b}\right)+\left(b^3-3 a^2 b\right) \tan
   ^{-1}\left(\frac{t}{a}\right)\right)}{a^3 b \left(a^2-b^2\right)^2
   \left(a^2+t^2\right)}$$ Expanded as a series
$$I=\int_{- t}^{+t} \frac{\mathrm{dx}}{({x}^{2} + {b}^{2}) {({x}^{2} + {a}^{2})}^{2}} =\frac{\pi  (2 a+b)}{2 a^3 b (a+b)^2}-\frac{2}{5
   t^5}+O\left(\frac{1}{t^7}\right)$$
