Solution (source code)

= Solution

Apply the <residue theorem> to the upper-half-plane semicircle, with a small semicircular indentation above the pole at $z=0$. The large arc contributes zero because $f(z)/z\to0$, so
$$
\frac{f(z)}{z(z^2+a^2)}=o(|z|^{-2}).
$$
The small indentation is traversed clockwise and contributes $-i\pi$ times the <residue> at zero. The only pole strictly inside the indented contour is $z=ia$. Therefore
$$
\operatorname{PV}\int_{-\infty}^{\infty}\frac{f(x)}{x(x^2+a^2)}\,dx
=2\pi i\operatorname{Res}_{z=ia}\frac{f(z)}{z(z^2+a^2)}
+i\pi\operatorname{Res}_{z=0}\frac{f(z)}{z(z^2+a^2)}.
$$
The two residues are
$$
\operatorname{Res}_{z=ia}=-\frac{f(ia)}{2a^2},
\qquad
\operatorname{Res}_{z=0}=\frac{f(0)}{a^2}.
$$
Consequently the <Cauchy principal value> is
$$
\boxed{\operatorname{PV}\int_{-\infty}^{\infty}\frac{f(x)}{x(x^2+a^2)}\,dx
=\frac{i\pi}{a^2}\bigl(f(0)-f(ia)\bigr).}
$$