<s>[INST] How to evaluate $\frac{1}{2\pi }\int_{-\pi }^{\pi }\dfrac{\sin n\theta }{\sin\theta }d\theta $? How to evaluate the integral given below?

$$\dfrac{1}{2\pi }\int_{-\pi }^{\pi }\dfrac{\sin n\theta }{\sin\theta }d\theta $$

 [/INST] Since the integrand is $ 2 \pi$-periodic,
$$ \begin{align} \frac{1}{2\pi } \int_{-\pi }^{\pi } \frac{\sin n\theta }{\sin\theta } \ d\theta &= \frac{1}{2 \pi} \int_{-\pi/2}^{3 \pi/2} \frac{\sin n \theta}{\sin \theta} \ d \theta \\ &=\frac{1}{2 \pi} \int_{-\pi/2}^{3 \pi/2} \text{Im} \frac{e^{in \theta}}{\sin \theta} \ d \theta \\ &= \frac{1}{2\pi} \text{Im} \ \text{PV} \int_{-\pi/2}^{3 \pi /2} \frac{e^{in \theta}}{\sin \theta \ } \ d \theta \tag{1} \\ &= \frac{1}{\pi} \text{Im} \ i \ \text{PV} \int_{-\pi/2}^{3 \pi /2} \frac{e^{in \theta}}{e^{i \theta}-e^{-i \theta}} \ d \theta . \end{align} $$
Now let $z=e^{i \theta}$.
Then
$$ \begin{align} \frac{1}{2\pi } \int_{-\pi }^{\pi } \frac{\sin n\theta }{\sin\theta } \ d\theta &= \frac{1}{\pi} \text{Im}\ i \ \text{PV} \int_{|z|=1} \frac{z^{n}}{z-z^{-1}}\frac{dz}{iz} \\ &= \frac{1}{\pi} \text{Im} \ \text{PV} \int_{|z|=1} \frac{z^{n}}{z^{2}-1} \ dz  \end{align}$$
where the unit circle is indented around the simple poles at $z=1$ and $z=-1$.
Therefore,
$$ \frac{1}{2\pi } \int_{-\pi }^{\pi } \frac{\sin n\theta }{\sin\theta } \ d\theta=  \frac{1}{\pi } \text{Im} \left(i \pi \ \text{Res} \left[\frac{z^{n}}{z^{2}-1},1 \right] + i \pi \ \text{Res} \left[\frac{z^{n}}{z^{2}-1},-1 \right]\right) .$$
If $n=2k+1$ (that is, if $n$ is odd),
$$ \frac{1}{2\pi }\int_{-\pi }^{\pi }\frac{\sin (2k+1)\theta }{\sin\theta } \ d\theta = \frac{1}{\pi } \text{Im} \left[i \pi \left(\frac{1}{2} \right) +i \pi \left(\frac{1}{2} \right) \right] = 1.$$
And if $n=2k$,
$$ \frac{1}{2\pi }\int_{-\pi }^{\pi } \frac{\sin 2k \theta }{\sin\theta } \ d\theta = \frac{1}{\pi } \text{Im} \left[i \pi \left(\frac{1}{2} \right) +i \pi \left(-\frac{1}{2} \right) \right] = 0 .$$
$ $
$(1)$ On the interval $[- \frac{\pi}{2}, \frac{3 \pi}{2} ]$, $\frac{e^{in \theta}}{\sin \theta}$ has a simple pole at $0$ and a simple pole at $\pi$.
</s>