<s>[INST] Evaluating $\int_{0}^{2\pi} \frac{\mathrm{e}^{-i k a \cos\phi \sin\theta}}{1+\cos\phi \sin\theta}\,\mathrm d\phi$ How to simplify the following equation: 
$$\int_{0}^{2\pi} \frac{\mathrm{e}^{-i k a \cos\phi  \sin\theta}}{1+\cos\phi \sin\theta}\,\mathrm d\phi$$
where $k$, $a$ and $\theta$ can be regarded as the constants, and $0<\theta<\frac{\pi}{2}$. Call $\sin\theta=b$ for brevity.
Attempt:
As Von Neumann pointed out, which is really helpful, using the residues theorem,
$$\frac{2}{ib}\int_{|z|=1} \frac{\exp\left(-ikab\left(\frac{z^2+1}{2z}\right)\right)}{z^2 + \frac{2}{b}z + 1}\ \text{d}z$$
Where does the pole locate?
$$z_{1,\ 2} = -\frac{1}{b}\pm \sqrt{\frac{1}{b^2}-1}$$ 
noted that:  $\frac{1}{b}=\frac{1}{\sin(\theta)}>1$, then only one pole within the circle is considered,where 
$$z_{1} = -\frac{1}{b}+ \sqrt{\frac{1}{b^2}-1}$$
Using the residues theorem, I got the result 
$$\frac{2\pi}{\cos\theta}\exp(ika)$$ 
Then I programmed the original integral and the derived result, there are discrepancies.  My question is that should we consider the numerator when using residues theorem? That is
 $$\exp\left(-ikab\left(\frac{z^2+1}{2z}\right)\right)$$ because using the pole $z_{1}$ we can derive that 
$$\cos\phi =\frac{z^2+1}{2z}=\frac{\left(-\frac{1}{b}+\sqrt{\frac{1}{b^2}-1}\right)^2+1}{2\left(-\frac{1}{b}+\sqrt{\frac{1}{b^2}-1}\right)} = -\frac{1}{b}=-\frac{1}{\sin\theta}$$
As it is shown that $$\cos\phi=-\frac{1}{\sin\theta}$$ which conflicts with each other. Could someone help? Thank you very much in advance. 
 [/INST] Methinks we can appreciate it carefully with residues theorem. 
First of all we step into the complex plane with the usual rules for sine and cosines, that is:
$$\mathcal{J} = \phi \to e^{i\psi} = z ~~~~~~~ \cos\phi \to \ \frac{1}{2}\left(z + \frac{1}{z}\right) ~~~~~~~ \text{d}\phi = \frac{\text{d}z}{iz}$$
We will also call $\sin\theta = b$ for brevity.
The integral becomes (arrange it a bit)
$$\frac{1}{2i}\int_{|z|=1} \frac{\exp\left(-ikab\left(\frac{z^2+1}{2z}\right)\right)}{1 + \frac{b}{2}\frac{z^2+1}{z}}\ \frac{\text{d}z}{z}$$
That is, 
$$\frac{1}{ib}\int_{|z|=1} \frac{\exp\left(-ikab\left(\frac{z^2+1}{2z}\right)\right)}{z^2 + \frac{2}{b}z + 1}\ \text{d}z$$
Poles occurs at $$z_{1,\ 2} = -\frac{1}{b}\pm \sqrt{\frac{1}{b^2}-1}$$
Now by residues theorem:
$$\mathcal{J} = 2\pi i \frac{1}{ib} \sum_{z_k} \lim_{z\to z_k} (z-z_k)f(z)|_{z = z_k}$$
Where 
$$f(z) = \frac{\exp\left(-ikab\left(\frac{z^2+1}{2z}\right)\right)}{(z-z_1)(z - z_2)}$$
Can you proceed? 
Doing the calculation you shall obtain:
$$\frac{2\pi}{b}\left(\frac{e^{-2 i a \sqrt{\frac{1}{b^2}-1} b k}}{2 \sqrt{\frac{1}{b^2}-1}} -\frac{e^{2 i a \sqrt{\frac{1}{b^2}-1} b k}}{2 \sqrt{\frac{1}{b^2}-1}}\right) = -\frac{2\pi}{b}\frac{i \sin \left(2 a \sqrt{\frac{1}{b^2}-1} b k\right)}{\sqrt{\frac{1}{b^2}-1}} = -\frac{2\pi}{b}\frac{i b \sin \left(2 a \sqrt{1-b^2} k\right)}{\sqrt{1-b^2}}$$
Eventually: 
$$-2\pi i\frac{ \sin \left(2 a \sqrt{1-b^2} k\right)}{\sqrt{1-b^2}}$$
Where $b = \sin\theta$.
I will check this again later, for the sake of correctness.
</s>