Contour integral with two poles I want to perform the following integral, using the Residue theorem:
$$ I=\int_{0}^{\infty} f(q) dq = \frac{1}{i r (2 \pi)^2} \int_{0}^{\infty} dq \frac{q \left( e ^{iqr} -  e^{-iqr}\right)}{M^2 + K q^2} =\frac{1} {2 i r (2 \pi)^2} \int_{- \infty}^{\infty} dq \frac{q \left( e ^{iqr} -  e^{-iqr}\right)}{\left(q + \frac{iM}{\sqrt{K}}  \right) \left( q - \frac{iM}{\sqrt{K}}\right)K}$$
Now I see that I have two poles (at $ q = \pm \frac{i M}{\sqrt{K}}$), but I don't understand how to take the integral with two poles properly and the answer I get is not correct.
I will give my calculation for the upper pole, but somehow I have an extra exponent which I don't know how to get rid of.
$$ \int_{- \infty}^{\infty} f(q) dq= \text{Res}(f, {M i}/{\sqrt{K}}) = 2 \pi i \lim_{q \to \frac{M i}{ \sqrt{K}}}  \frac{1} {2 i r (2 \pi)^2}  \frac{q \left( e ^{iqr} -  e^{-iqr}\right)}{\left(q + \frac{iM}{\sqrt{K}}  \right)K} =  \frac{1} {2  r (2 \pi)}  \frac{e^{\frac{-M r}{ \sqrt{K}}}- e^{\frac{M r}{\sqrt{K}}}}{2} $$
For the other contour I get the same result, but I know that the final result should be:
$$I=\frac{e ^{\frac{- r M}{\sqrt{K}}}}{4 \pi K r}. $$
 But then my exponent should go away, furthermore I don't really understand how to combine the two contour integrals. They are around different poles, but to calculate the integral over the real axis I cannot go around both contours with one integral. Could someone please explain how to do this integration properly and how to combine these two integrals.
 A: Hint:
$$
\int_{-\infty}^\infty dx \, \frac{x e^{ix}}{x^2+a^2} = 
\int_{0}^\infty dx \, \frac{x \left(e^{ix}-e^{-ix}\right)}{x^2+a^2} \; .
$$
Thus, you evaluate the former integral by closing the contour in the upper-half plane and evaluating the residue at $x = i a$.  The result is
$$
\oint dx \, \frac{x e^{ix}}{x^2+a^2} = i \pi e^{-a} \; .$$
A: Okay after some more thought and the hints of jcandy and Robert Z, I think I'm able to solve the integral.
The problem is that for $ R-> + \infty$, the $e^{-iqr}$ part of the integral doesn't go to zero. To solve this problem, we should split up the integral into the following parts
$$ I=\int_{- \infty}^{\infty} f(q) dq = \int_{- \infty}^{\infty} g(q) - h(q) dq 
\\
 =\frac{1} {2 i r (2 \pi)^2} \left( \int_{- \infty}^{\infty} dq \frac{q e^{iqr}}{\left(q + \frac{iM}{\sqrt{K}}  \right) \left( q - \frac{iM}{\sqrt{K}}\right)K} - \frac{q \ e^{-iqr}}{\left(q + \frac{iM}{\sqrt{K}}  \right) \left( q - \frac{iM}{\sqrt{K}}\right)K}\right)$$
Now the integral can be solved for both parts independently, where the contour for $g(q)$ is taken into the positive imaginary part and for $h(q)$ the negative.
$$\frac{1} {2 i r (2 \pi)^2} \int_{- \infty}^{\infty} dq \frac{q e^{iqr}}{\left(q + \frac{iM}{\sqrt{K}}  \right) \left( q - \frac{iM}{\sqrt{K}}\right)K} \\
= \frac{1} {2 K i r (2 \pi)^2} \lim_{q \to \frac{M i}{ \sqrt{K}}}  \frac{1} {2 i r (2 \pi)^2}  \frac{q  e ^{iqr} }{\left(q + \frac{iM}{\sqrt{K}}  \right)} =  \frac{1} {4 \pi r K}  \frac{e^{\frac{-M r}{ \sqrt{K}}}}{2}  $$
The same can be done for $h(q)$ which gives:
$$\frac{1} {2 i r (2 \pi)^2} \int_{- \infty}^{\infty} dq \frac{q e^{-iqr}}{\left(q + \frac{iM}{\sqrt{K}}  \right) \left( q - \frac{iM}{\sqrt{K}}\right)K} \\
= \frac{-1} {2 K i r (2 \pi)^2} \lim_{q \to \frac{ - M i}{ \sqrt{K}}}  \frac{1} {2 i r (2 \pi)^2}  \frac{q  e ^{-iqr} }{\left(q - \frac{iM}{\sqrt{K}}  \right)} =  \frac{1} {4 \pi r K}  \frac{e^{\frac{-M r}{ \sqrt{K}}}}{2}  $$
So we get
$$I = \frac{1} {4 \pi r K }  {e^{\frac{-M r}{ \sqrt{K}}}} $$
