The problem here is to evaluate $$ \int_0^\infty \frac{x}{(x^2 + a^2) \, \sin(\mu x)} dx $$ for $a,\mu >0.$ Clearly this integral doesn't converge in the usual sense, but we can calculate its Cauchy Principal Value.
My attempt was to integrate the function in the complex domain along a quartercircle-contour in the first quadrant, with little bumps at $z=ia$ and $z = \frac{n \pi}{\mu}, n \in \mathbb{N}_{>0}.$ The infinitely many poles along the positive real axis worry me. The residue at $\frac{n \pi}{\mu}$ is $ \frac{(-1)^n}{ a^2\mu^2 + \pi^2 n^2}$, so we should evaluate $\sum_{n=1}^{\infty} \frac{(-1)^n}{ a^2\mu^2 + \pi^2 n^2}. $
How can we do that? How can we evaluate this integral? I'd really appreciate an approach with contour integration.
Note: The solution is $$ PV \int_0^\infty \frac{x}{(x^2 + a^2) \, \sin(\mu x)} dx = \frac{\pi}{2 \, \sinh(\mu a)},$$ but I want to prove it.
The integrand is even, hence
$$\operatorname{v.p.} \int_0^{\infty} \frac{x}{(x^2+a^2)\sin (\mu x)}\,dx = \frac{1}{2} \operatorname{v.p.} \int_{-\infty}^{\infty} \frac{x}{(x^2+a^2)\sin (\mu x)}\,dx.\tag{$\ast$}$$
For this we can use a standard semicircular contour, modified by small semicircles around the poles on the real axis. Let's choose the small semicircles around the real poles and the large semicircle in the upper half-plane, then, if $C_R$ denotes the contour where the large semicircle has radius $R > a$, we have
$$\int_{C_R} \frac{z}{(z^2+a^2)\sin (\mu z)}\,dz = 2\pi i \operatorname{Res} \biggl(\frac{z}{(z^2+a^2)\sin (\mu z)}; ia\biggr) = 2\pi i \frac{ia}{2ia\sin (\mu ia)} = \frac{\pi}{\sinh (\mu a)},$$
independent of $R$. Since $\lvert \sin (\mu z)\rvert$ grows exponentially as $\operatorname{Im} z \to \infty$, the integral over the large semicircle tends to $0$ as $R \to \infty$ in such a way that the poles on the real axis are avoided.
If we let the radius $\varepsilon$ of the small semicircles around the poles shrink to $0$, the integral over the small semicircle around $\frac{k\pi}{\mu}$ converges to $r_k := -\pi i \operatorname{Res}\bigl(\frac{z}{(z^2+a^2)\sin (\mu z)}; \frac{k\pi}{\mu}\bigr)$. But since the integrand is an even function, we have $r_{-k} = -r_k$, and hence
$$\sum_{0 < \lvert k\rvert < \mu R/\pi} r_k = 0$$
for all $R$ (subject to the restrictions above).
Therefore,
$$\operatorname{v.p.} \int_{-\infty}^{\infty} \frac{x}{(x^2+a^2)\sin (\mu x)}\,dx = \frac{\pi}{\sinh (\mu a)}.$$
By $(\ast)$,
$$\operatorname{v.p.} \int_{0}^{\infty} \frac{x}{(x^2+a^2)\sin (\mu x)}\,dx = \frac{\pi}{2\sinh (\mu a)}.$$