(Lecture 24 of Mathematical Methods II.)
Residue theory has various applications, of which we will overview the most important.
Integrals of rational functions on the real line. We have already seen how complex integration allows for the evaluation of rational functions in the polar form. A similar technique can be computed for some integrals of the type $\int_{-\infty}^{+\infty}f(x)\,dx$. Such integrals may not exist, for instance, $\int_{-\infty}^\infty x\,dx=\frac{1}{2}x^2\big|_{-\infty}^{+\infty}$ which is undefined. Taking the limit of always well-defined integrals, we introduce the Cauchy Principal Value:
\begin{equation} \tag{1} \mathrm{PV}\int_{-R}^R f(x)\,dx=\lim_{R\rightarrow\infty}\int_{-R}^R f(x)\,dx\,, \end{equation}
which in the case above gives a well-defined and finite result: $\mathrm{PV}\int_{-\infty}^\infty x\,dx=0$. These integrals turn out to be useful in physics whereas the undefined version is merely a frustration.
A first nontrivial application of Residues is to compute integrals of rational functions $P/Q$ with $\deg(Q)\ge\deg(P)+2$ and $Q(x)\neq0$ for all~$x\in\mathbf{R}$:
\begin{equation} \tag{2} \mathrm{PV}\int_{-\infty}^\infty\frac{P(x)}{Q(x)}\,dx=2i\pi\sum_{j=1}^k\mathrm{Res}\left[\frac{P}{Q},z_j\right] \end{equation}
where $z_j$ for $1\le j\le k$ are the poles in the upper complex plane $\mathrm{Im}(z)\ge 0$.
Proof: The key idea is to close the integral in the complex plane, so that:
\begin{equation} \tag{3} \int_{-\infty}^\infty\frac{P(x)}{Q(x)}\,dx = \int_{\mathcal{C}}\frac{P(z)}{Q(z)}\,dz -\int_{\mathcal{C}_R}\frac{P(z)}{Q(z)}\,dz \end{equation}
with $\mathcal{C}_R$ the half circle of radius~$R$ centered on the origin, and $\mathcal{C}=[-R,R]\bigcup\mathcal{C}_R$. We know that $\int_{\mathcal{C}}\frac{P(z)}{Q(z)}\,dz=2i\pi\sum_{j=1}^k\mathrm{Res}[\frac{P}{Q},z_j]$ if the circle is large enough to encloses all the poles, so the proof is complete if we show that $\lim_{R\rightarrow\infty}\int_{\mathcal{C}_R}\frac{P(z)}{Q(z)}\,dz=0$.
Let us spell out the expressions of the polynomials:
\begin{equation} \tag{4} P(z)=\sum_{k=0}^ma_kz^k\quad\mathrm{and}\quad Q(z)=\sum_{k=0}^nb_kz^k\,, \end{equation}
with $n\ge m+2$. It follows that:
\begin{equation} \tag{5} \frac{zP(z)}{Q(z)}=\frac{\displaystyle z^{m+1}\sum_{k=0}^ma_kz^{k-m}}{\displaystyle z^n\sum_{k=0}^nb_kz^{k-n}}\,, \end{equation}
so that
\begin{equation} \label{eq: lunabr7123441CEST2014} \lim_{|z|\rightarrow\infty}\frac{zP(z)}{Q(z)}=\lim_{|z|\rightarrow\infty}\frac{z^{m+1}}{z^n}\lim_{|z|\rightarrow\infty}\frac{\displaystyle\sum_{k=0}^ma_kz^{k-m}}{\displaystyle\sum_{k=0}^nb_kz^{k-n}}\,. \end{equation}
Now since $n\ge m+2$, $\lim_{|z|\rightarrow\infty}1/z^{n-(m+1)}=0$. On the other hand,
\begin{equation} \lim_{|z|\rightarrow\infty}\frac{a_m+a_{m-1}z^{-1}+\cdots+a_0 z^{-m}}{b_n+b_{n-1}z^{-1}+\cdots+b_0 z^{-n}}=\frac{a_m}{b_n}\neq0\,, \end{equation}
so that the limit is zero. Therefore, for any~$\epsilon>0$, there exists $R$ such that $(|z|>R)\Rightarrow(|zP(z)/Q(z)|<\epsilon)$. We can therefore choose a circle large enough so that: % \begin{equation} \tag{6} \left|\frac{P(z)}{Q(z)}\right|<\frac{\epsilon}{\pi|z|}\,. \end{equation}
Using the ML inequality, we arrive to $|\int_{\mathcal{C}_R}\frac{P(z)}{Q(z)}\,dz|\le\frac{\epsilon}{\pi R}(\pi R)$, i.e., the limit of this part of the integral is zero.
For instance, we can readily compute in this way:
\begin{equation} \tag{7} \int_{-\infty}^{\infty}\frac{dx}{(x^2+1)(x^2+4)}=\pi/6\,. \end{equation}
To find this, we introduce $f(z)=\frac{1}{(z+i)(z-i)(z+2i)(z-2i)}$, which has residues in the upper plane $\mathrm{Res}_{z=i}(f)=-i/6$ and $\mathrm{Res}_{z=2i}(f)=i/12$, so that, the integral is $2i\pi(-i/6+i/12)$.
If $Q(x)$ has poles on the real axis, the theorem reads, in the same conditions as above:
\begin{equation} \tag{8} \mathrm{PV}\int_{-\infty}^\infty\frac{P(x)}{Q(x)}\,dx=2i\pi\sum_{j=1}^k\mathrm{Res}\left[\frac{P}{Q},z_j\right]+i\pi\sum_{j=1}^l\mathrm{Res}\left[\frac{P}{Q},x_j\right] \end{equation}
with $x_1$, $\dots$, $x_l$ simple poles on the real axis.