I need to calculate $$I_0=\int_{-\infty}^\infty\frac{e^{ix}}{x}dx=\lim_{R\rightarrow\infty}\int_{-R}^R\frac{e^{ix}}{x}dx=\lim_{R\rightarrow 0}(\lim_{\varepsilon\rightarrow 0}(\int_{-R}^\varepsilon\frac{e^{ix}}{x}dx+\int_{-\varepsilon}^R\frac{e^{ix}}{x}dx))=\lim_{R\rightarrow 0}(\lim_{\varepsilon\rightarrow 0}I(R,\varepsilon))$$
I have tried to close the contour of the complex integral on the complex plain. Let $C$ be the semicircle with radius R above the real axis and $\gamma$ be the semicircle under the real axis with radius $\varepsilon$, both centered at $O$. Let $L$ be the closed contour contained $C,[-R,-\varepsilon],\gamma,[\varepsilon,R]$. Denote the $+$ direction by the $+$ direction of $L$. Then we have:
$$\int_{L^+}\frac{e^{iz}}{z}dz=I(R,\varepsilon)+\int_{C^+}\frac{e^{iz}}{z}dz+\int_{\gamma^+}\frac{e^{iz}}{z}dz$$
By Cauchy Integral Formula we have $\int_{L^+}\frac{e^{iz}}{z}dz=2\pi i$ so
$$I(R,\varepsilon)=2\pi i-\int_{C^+}\frac{e^{iz}}{z}dz-\int_{\gamma^+}\frac{e^{iz}}{z}dz$$
Take $\varepsilon\rightarrow 0$ we have:
$$I(R,0)=\pi i-\int_{C^+}\frac{e^{iz}}{z}dz=\pi i-\int_0^{\pi}\frac{e^{iRe^{i\phi}}}{Re^{i\phi}}iRe^{i\phi}d\phi$$
$$=\pi i-i\int_0^\pi\exp(iR(\cos\phi+i\sin\phi))d\phi=\pi i-i\int_0^\pi e^{iR\cos\phi}e^{-R\sin\phi}d\phi$$
Now I must take the limit $R\rightarrow\infty$. I evaluate:
$$\left|\int_0^\pi e^{iR\cos\phi}e^{-R\sin\phi}d\phi\right|\le\int_0^\pi e^{-R\sin\phi}d\phi$$
Is there anything wrong in my argument so far? How can I proceed further?
EDIT1: Looking at it for quite long I think I can write
$$\int_0^\pi e^{-R\sin\phi}d\phi=2\int_0^{\pi/2} e^{-R\sin\phi}d\phi\le 2\int_0^{\pi/2} e^{-R\frac{\phi}{2}}d\phi=\frac{4}{R}(1-e^{-R\frac{\pi}{4}})\le\frac{4}{R}$$
So in the end take $R\rightarrow\infty$ we get $I_0=i\pi$. Is it true?
First you can estimate $\displaystyle \int_0^\pi e^{-R\sin\phi}d\phi=2\int_0^{\pi/2} e^{-R\sin\phi}d\phi$ when $R \to \infty$. You have:
$$\int_0^{\pi/2} e^{-R\sin\phi}d\phi=\int_0^{\arcsin \frac{1}{\sqrt{R}}} e^{-R\sin\phi}d\phi+\int_{\arcsin \frac{1}{\sqrt{R}}}^{\pi/2} e^{-R\sin\phi}d\phi$$
In first integral $e^{r\sin \phi} \leq 1$, so:
$$\int_0^{\arcsin \frac{1}{\sqrt{R}}}e^{-R\sin\phi}d\phi \leq \int_0^{\arcsin \frac{1}{\sqrt{R}}} 1 \; d\phi=\arcsin \frac{1}{\sqrt{R}} \to 0$$
when $R \to \infty$.Next consider second integral. $\sin$ on $[0,\pi/2]$ is monotonic increasing, so:
$$\int_{\arcsin \frac{1}{\sqrt{R}}}^{\pi/2} e^{-R\sin\phi}d\phi \leq \int_{\arcsin \frac{1}{\sqrt{R}}}^{\pi/2} e^{-R\sin(\arcsin \frac{1}{\sqrt{R}})}d\phi=\int_{\arcsin \frac{1}{\sqrt{R}}}^{\pi/2} e^{-\sqrt{R}}d\phi \to 0$$
when $R \to \infty$.