Note: In an effort to provide any necessary context you may need to help me, I have provided a large run-up to my question. The real question itself begins near the bottom with the bold words "My problem is with term 3."
Per the advice of Andy Wells, I am trying to solve the complex contour integral
$$ \oint_C \frac{i e^{izt}}{\alpha (z-\omega_0)(z-\omega_1)(z-\omega_2)}dz, $$
where $\omega_0$ is a real root, and $\omega_1$ and $\omega_2$ are complex roots. Assume a semicircular contour $C$ in the top half of the complex plane of radius $R$, centered at the origin. The contour encloses $\omega_1$ and $\omega_2$, while narrowly avoiding $\omega_0$ by taking a tiny semicircular excursion of radius $r$ up into the top half of the complex plane. We traverse the contour counterclockwise. In order to enclose the entire top half of the complex plane, we will need to take the limit
$$ I = \lim_{R\rightarrow \infty, r \rightarrow 0} \left[ \oint_C \frac{i e^{izt}}{\alpha (z-\omega_0)(z-\omega_1)(z-\omega_2)}dz \right]. $$
The contour can be broken into four segments, each of which will require its own term:
- The integral over the big arc of radius $R$. For this term $z = Re^{i\omega}$, and $dz = i R e^{i\omega}$
- The integral over the straight line segment along the real axis between $-R$ and $\omega_0-r$. For this term $z= \omega$ and $dz = d\omega$.
- The integral over the small arc of radius $r$. For this term $ z = \omega_0 + re^{i\omega}$ and $dz = ire^{i \omega}$.
- The integral over the straight line segment along the real axis between $\omega_0+r$ and $R$. For this term $z= \omega$ and $dz = d\omega$.
Thus, the integral becomes
$$ I = \lim_{R\rightarrow \infty, r \rightarrow 0} \left[ \int_0^\pi \frac{i e^{iRe^{i\omega}t}}{\alpha (Re^{i\omega}-\omega_0)(Re^{i\omega}-\omega_1)(Re^{i\omega}-\omega_2)}i R e^{i\omega}d\omega \\ + \int_{-R}^{\omega_0-r} \frac{i e^{i\omega t}}{\alpha (\omega-\omega_0)(\omega-\omega_1)(\omega-\omega_2)}d\omega \\ + \int_\pi^0 \frac{i e^{i(\omega_0+ re^{i\omega})t}}{\alpha (re^{i\omega})(\omega_0 + re^{i\omega}-\omega_1)(\omega_0 + re^{i\omega}-\omega_2)}i r e^{i\omega}d\omega \\ + \int_{\omega_0 + r}^{R} \frac{i e^{i\omega t}}{\alpha (\omega-\omega_0)(\omega-\omega_1)(\omega-\omega_2)}d\omega\right], $$
where the terms are ordered in the same manner as the list. I understand that $$ \mathrm{Term~1} = 0 $$ by Jordan's Lemma, and that terms 2 and 4 combine in the limit to simply become $$ \mathrm{Term~2+4} = P.V. \int_{-\infty}^{\infty} \frac{i e^{i\omega t}}{\alpha (\omega-\omega_0)(\omega-\omega_1)(\omega-\omega_2)}d\omega. $$
My problem is with term 3. In Andy's derivation he first simplifies the term to, $$ \mathrm{Term~3} = \lim_{R\rightarrow \infty, r \rightarrow 0} \left[ \frac{e^{i \omega_0 t}}{\alpha} \int_0^\pi \frac{e^{ire^{i\omega}t}}{(\omega_0 + re^{i\omega}-\omega_1)(\omega_0 + re^{i\omega}-\omega_2)}d\omega \right] $$ where we note that the two factors of $i$ create a negative sign which flips the limits of integration.
And then something weird happens. It appears that Andy flips the integration and the limit operations such that we end up with $$ \mathrm{Term~3} = \frac{\pi e^{i \omega_0 t}}{\alpha (\omega_0 - \omega_1)(\omega_0 - \omega_2)}. $$ Indeed, flipping the integration and limit operations make this integral easy enough to solve, and I can confirm that this is what I get, but I have absolutely no idea why. Can you please help me understand what he has done?
(The relevant step in the original answer begins below the first instance of the words "From the Residue Theorem.")