Improper integral involving trigonometric function I was wondering what happens when evaluating an improper integral involving a trigonometric function where the denominator is a rational function with a zero at $x=0$. 
The example I have in mind is
$$\int_{-\infty}^{\infty}\frac{sin(ax)}{x(x-i)(x+i)} dx$$
If I rewrite the sine in terms of the exponential and then evaluate two integrals, one for the upper half-plane and one for the lower I have a problem because of the singularity at $z=0$ which seems to be in both halves of the plane. Do I treat it in both integrals then? Any suggestions/comments are welcome.
 A: One way of avoiding to deal with the (redundant) singularity after spliting the integrals is to first differentiate w.r.t. $a$ and use Eulers identity
$$
I'(a)=\Re \int_{\mathbb{R}} \frac{e^{i a x}}{(x-i)(x+i)}
$$
Assuming that $a>0$ we have to close our contour of integration, which is a big semicircle , in the upper halfplane(for $a<0$ it is the other way round)
We get
$$
I'(a)=\Re(2\pi i \text{Res}(x=i))=\pi e^{-a}
$$
integrating back w.r.t. $a$ yields 
$$
I(a)=-\pi e^{-a}+C
$$
and the constant of integration is fixed by the requirement that $I(0)=0$
which brings us to our final result

$$
I(a)=\pi(1-e^{-a})
$$

I leave the case $a<0$ to you
A: Another approach is to use partial fraction expansion to write 
$$\int_{-\infty}^\infty\frac{\sin(ax)}{x(x^2+1)}\,dx=\int_{-\infty}^\infty\frac{\sin(ax)}{x}\,dx-\int_{-\infty}^\infty\frac{x\sin(ax)}{x^2+1}\,dx \tag 1$$
Now, the first integral on the right-hand side of $(1)$ can be evaluated by using Cauchy's Integral Theorem and writing
$$\begin{align}
\int_{-\infty}^\infty\frac{\sin(ax)}{x}\,dx&=\lim_{\epsilon \to 0^+}\left(\text{Im}\left(\int_{-\infty}^{-\epsilon}\frac{e^{iax}}{x}\,dx+\int_\epsilon^\infty \frac{e^{iax}}{x}\,dx\right)\right)\\\\
&=\lim_{\epsilon \to 0^+}\left(-\text{sgn}(a)\text{Im}\left(\int_\pi^0 \frac{e^{ia\epsilon e^{i\theta}}}{\epsilon e^{^{i\theta}}}\,i\epsilon e^{i\theta}\,d\theta\right)\right)\\\\
&=\pi\, \text{sgn}(a)
\end{align}$$ 
where we have tacitly used Jordan's Lemma to find that the contribution from integration over the infinite semi-circular contour integral that encloses the contour in a half plane is zero.
More simply, using the Residue Theorem, the second integral on the right-hand side of $(1)$ becomes
$$\int_{-\infty}^\infty \frac{x\sin(ax)}{x^2+1}\,dx=2\pi i \,\text{sgn}(a)\,\text{Im}\left(\text{Res}\left(\frac{ze^{iaz}}{z^2+1},z= i \text{sgn}(a)\right)\right)=\text{sgn}(a)\pi e^{-|a|}$$
where again, one can use Jordan's Lemma to show that the contribution from integration over the infinite semi-circle is zero.
Putting everything together yields
$$\bbox[5px,border:2px solid #C0A000]{\int_{-\infty}^\infty\frac{\sin(ax)}{x(x^2+1)}\,dx=\pi\, \text{sgn}(a)\left(1-e^{-|a|}\right)}$$
