Residue theorem: Let <math>U</math> be a simply connectedopen subset of the complex plane containing a finite list of points <math>a_1, \ldots, a_n,</math> <math>U_0 = U \smallsetminus \{a_1, \ldots, a_n\},</math> and a function <math>f</math> holomorphic on <math>U_0.</math> Letting <math>\gamma</math> be a closed rectifiable curve in <math>U_0,</math> and denoting the residue of <math>f</math> at each point <math>a_k</math> by <math>\operatorname{Res}(f, a_k)</math> and the winding number of <math>\gamma</math> around <math>a_k</math> by <math>\operatorname{I}(\gamma, a_k),</math> the line integral of <math>f</math> around <math>\gamma</math> is equal to <math>2\pi i</math> times the sum of residues, each counted as many times as <math>\gamma</math> winds around the respective point:
If <math>\gamma</math> is a positively orientedsimple closed curve, <math>\operatorname{I}(\gamma, a_k)</math> is <math>1</math> if <math>a_k</math> is in the interior of <math>\gamma</math> and <math>0</math> if not, therefore
with the sum over those <math>a_k</math> inside Template:Nobr
The relationship of the residue theorem to Stokes' theorem is given by the Jordan curve theorem. The general plane curveTemplate:Mvar must first be reduced to a set of simple closed curves <math>\{\gamma_i\}</math> whose total is equivalent to <math>\gamma</math> for integration purposes; this reduces the problem to finding the integral of <math>f\, dz</math> along a Jordan curve <math>\gamma_i</math> with interior <math>V.</math> The requirement that <math>f</math> be holomorphic on <math>U_0 = U \smallsetminus \{a_k\}</math> is equivalent to the statement that the exterior derivative <math>d(f\, dz) = 0</math> on <math>U_0.</math> Thus if two planar regions <math>V</math> and <math>W</math> of <math>U</math> enclose the same subset <math>\{a_j\}</math> of <math>\{a_k\},</math> the regions <math>V \smallsetminus W</math> and <math>W \smallsetminus V</math> lie entirely in <math>U_0,</math> hence
is well-defined and equal to zero. Consequently, the contour integral of <math>f\, dz</math> along <math>\gamma_j = \partial V</math> is equal to the sum of a set of integrals along paths <math>\gamma_j,</math> each enclosing an arbitrarily small region around a single <math>a_j</math> — the residues of <math>f</math> (up to the conventional factor <math>2\pi i</math> at <math>\{a_j\}.</math> Summing over <math>\{\gamma_j\},</math> we recover the final expression of the contour integral in terms of the winding numbers <math>\{\operatorname{I}(\gamma, a_k)\}.</math>
In order to evaluate real integrals, the residue theorem is used in the following manner: the integrand is extended to the complex plane and its residues are computed (which is usually easy), and a part of the real axis is extended to a closed curve by attaching a half-circle in the upper or lower half-plane, forming a semicircle. The integral over this curve can then be computed using the residue theorem. Often, the half-circle part of the integral will tend towards zero as the radius of the half-circle grows, leaving only the real-axis part of the integral, the one we were originally interested in.
Since Template:Math is an entire function (having no singularities at any point in the complex plane), this function has singularities only where the denominator Template:Math is zero. Since Template:Math, that happens only where Template:Math or Template:Math. Only one of those points is in the region bounded by this contour. Because Template:Math is
<math display="block">\begin{align}
\frac{e^{itz}}{z^2+1} & =\frac{e^{itz}}{2i}\left(\frac{1}{z-i}-\frac{1}{z+i}\right) \\
& =\frac{e^{itz}}{2i(z-i)} -\frac{e^{itz}}{2i(z+i)} ,
\end{align}</math>
the residue of Template:Math at Template:Math is
<math display="block">\operatorname{Res}_{z=i}f(z)=\frac{e^{-t}}{2i}.</math>
According to the residue theorem, then, we have
<math display="block">\int_C f(z)\,dz=2\pi i\cdot\operatorname{Res}\limits_{z=i}f(z)=2\pi i \frac{e^{-t}}{2i} = \pi e^{-t}.</math>
The contour Template:Mvar may be split into a straight part and a curved arc, so that
<math display="block">\int_{\mathrm{straight}} f(z)\,dz+\int_{\mathrm{arc}} f(z)\,dz=\pi e^{-t}</math>
and thus
<math display="block">\int_{-a}^a f(z)\,dz =\pi e^{-t}-\int_{\mathrm{arc}} f(z)\,dz.</math>
Using some estimations, we have
<math display="block">\left|\int_{\mathrm{arc}}\frac{e^{itz}}{z^2+1}\,dz\right| \leq \pi a \cdot \sup_{\text{arc}} \left| \frac{e^{itz}}{z^2+1} \right| \leq \pi a \cdot \sup_{\text{arc}} \frac{1}{|z^2+1|} \leq \frac{\pi a}{a^2 - 1},</math>
and
<math display="block">\lim_{a \to \infty} \frac{\pi a}{a^2-1} = 0.</math>
The estimate on the numerator follows since Template:Math, and for complex numbersTemplate:Mvar along the arc (which lies in the upper half-plane), the argument Template:Mvar of Template:Mvar lies between 0 and Template:Pi. So,
<math display="block">\left|e^{itz}\right| = \left|e^{it|z|(\cos\varphi + i\sin\varphi)}\right|=\left|e^{-t|z|\sin\varphi + it|z|\cos\varphi}\right|=e^{-t|z| \sin\varphi} \le 1.</math>
The fact that Template:Math has simple poles with residue 1 at each integer can be used to compute the sum
<math display="block"> \sum_{n=-\infty}^\infty f(n).</math>
The left-hand side goes to zero as Template:Math since <math>|\cot(\pi z)|</math> is uniformly bounded on the contour, thanks to using <math>x = \pm \left(\frac 12 + N\right)</math> on the left and right side of the contour, and so the integrand has order <math>O(N^{-2})</math> over the entire contour. On the other hand,<ref>Template:Harvnb. Note that the Bernoulli number <math>B_{2n}</math> is denoted by <math>B_{n}</math> in Whittaker & Watson's book.</ref>
<math display="block">\frac{z}{2} \cot\left(\frac{z}{2}\right) = 1 - B_2 \frac{z^2}{2!} + \cdots </math> where the Bernoulli number <math>B_2 = \frac{1}{6}.</math>
<math display="block">\sum_{n = 1}^\infty \frac{1}{n^2} = \frac{\pi^2}{6}</math>
which is a proof of the Basel problem.
The same argument works for all <math>f(x) = x^{-2n}</math> where <math>n</math> is a positive integer, giving us<math display="block"> \zeta(2n) = \frac{(-1)^{n+1}B_{2n}(2\pi)^{2n}}{2(2n)!}.</math>The trick does not work when <math>f(x) = x^{-2n-1}</math>, since in this case, the residue at zero vanishes, and we obtain the useless identity <math>0 + \zeta(2n+1) - \zeta(2n+1) = 0</math>.
The same trick can be used to establish the sum of the Eisenstein series:<math display="block">\pi \cot(\pi z) = \lim_{N \to \infty} \sum_{n=-N}^N (z - n)^{-1}.</math>