Showing $\int_{0}^{\infty} \frac{\sin{x}}{x} \ dx = \frac{\pi}{2}$ using complex integration

We need to use $f(z) = (e^{iz} - 1)/z$ because it has a removable singularity at $z = 0$. Consider a contour $C = [-R, R] \cup C_R$ for $R > 0$. Then $$I \equiv \int_{-R}^R f(z)dz + \int_{C_R} f(z)dz = 0$$ by Cauchy Theorem, i.e., $$\int_{-R}^R f(z)dz = \int_{C_R} \frac{1}{z}dz - \int_{C_R} \frac{e^{iz}}{z}dz$$ but $$\int_{C_R} \frac{1}{z}dz = \pi i$$ and we can show that the other integral goes to zero as $R \to \infty$. Therefore, because $$\int_{-R}^R \frac{\sin x}{x}dx = \operatorname{Im}I,$$ we see that $$\int_{-\infty}^\infty \frac{\sin x}{x}dx = \pi$$ or $$\int_0^\infty \frac{\sin x}{x}dx = \frac{\pi}{2}.$$

Hope this helps.