How to evaluate $\int_{-\pi}^{\pi} \frac{\sin\left(e^{ix}\right)}{e^{ix}} dx$? I'm trying to explicitly evaluate the following integral
$$
\int_{-\pi}^{\pi} \frac{\sin\left(e^{ix}\right)}{e^{ix}} dx
$$
I checked on WolframAlpha that the value of the integral is $2 \pi$. Using this, I attempted the following.

I analyze the conjugate of the integral and see that
$$
\overline{\int_{-\pi}^{\pi} \frac{\sin\left(e^{ix}\right)}{e^{ix}} dx} = \int_{-\pi}^{\pi} \frac{\overline{\sin\left(e^{ix}\right)}}{\overline{e^{ix}}} dx = \int_{-\pi}^{\pi} \frac{\sin\left(e^{-ix}\right)}{e^{-ix}} dx \overset{\color{blue}{u = -x}}{=}\int_{-\pi}^{\pi} \frac{\sin\left(e^{iu}\right)}{e^{iu}} du
$$
which confirms to us that the integral is real. From here we can simplify our integral by finding $\Re\left(\frac{\sin\left(e^{ix}\right)}{e^{ix}} \right)$.
To avoid clutter, here I defined $c(t) := \cos(t)$ and $s(t):= \sin(t)$. Keeping this in mind, I get that
\begin{align}
\Re\left(\sin\left(e^{ix}\right)e^{-ix} \right) &= \Re\left(\sin(c + is) (c -is) \right) = \Re\left(\frac{e^{-s}e^{ic}-e^{s}e^{ic}}{2i} (c -is) \right)\\
&=\Re\left(\frac{1}{2}\left(e^{-s}\left[\underbrace{\color{blue}{c\{c\}}}_{\cos(\cos(t)} + i\underbrace{\color{blue}{s\{c\}}}_{\sin(\cos(t)}\right]- e^{s}\left[c\{c\} -i s\{c\}\right] \right) (-s -ic) \right)\\
&=\frac{1}{2} \left(-e^{-s}c\{c\}s + e^{s}c\{c\}s +e^{-s}s\{c\}c +e^s s\{c\}c \right)\\
&=s \cos(c) \left(\frac{e^s -e^{-s}}{2}\right) + c \sin(c) \left(\frac{e^s +e^{-s}}{2}\right)\\
&=\sin(t) \cos(\cos(t))\sinh(\sin(t)) + \cos(t) \sin(\cos(t))\cosh(\sin(t))
\end{align}
And here is where I ran into trouble, because I have no idea how I could integrate that last expression. I tried exploiting symmetry, but the function is even, so I don't think I can do much with it without finding an antiderivative (which sounds very unpleasant).
Does anyone know how I could finish my solution? Or alternatively, does anyone know a simpler way in which I can prove this result? Thank you very much!
 A: Let $z=e^{ix}$.  Then the integral becomes
$$\oint_{|z|=1} \frac{\sin(z)}{iz^2}\,dz$$
Can you finish?
A: You should be able to use Cauchy's integral formula. Your integral can be re-written as
$$\int_0^{2\pi}f(e^{ix})\,dx,$$
where $f(x)=\sin(x)/x$. Now substitute $u=e^{ix}$, $du/u=idx$ so that your integral becomes
$$\frac{1}{i}\int_\gamma \frac{f(u)}{u}\,du.$$
Here, $\gamma$ denotes the unit circle centered at the origin in the complex plane. Cauchy told us that this integral is just $2\pi f(0)$, or in your case,
$$2\pi.$$
EDIT:
In fact, if $f$ is holomorphic on the unit disk, we have that
$$\int_0^{2\pi} f(e^{i\theta})\,d\theta=2\pi f(0).$$
A: Consider the contour integral of $\frac{\sin(z)}{z^2}$ over the circle $\gamma$. Parametrizing the circle over the interval $[-\pi, \pi]$ gives us $i \int \frac{\sin{e^{ix}}}{e^{iz}} dx$.
We can take the Taylor expansion of $\sin(z)$ to get that the contour integral is equal to $\int_\gamma \sum\limits_{i = 0}^\infty \frac{z^{2i - 1}}{(2i + 1)!} dz$. Since the sum is uniformly convergent over the circle, we can swap the sum and the integral to get $\sum\limits_{i = 0}^\infty \int_\gamma \frac{z^{2i -1}}{(2i - 1)!}$. But for $i > 0$, this is the integral of a monomial over a closed path, so the only term that matters is the $i = 0$ term.
Thus, the integral equals $\int_\gamma \frac{1}{z} dz = 2 \pi i$.
Then your original integral is, in fact, $2 \pi$.
