Applications of the Residue Theorem to the Evaluation of Integrals and Sums
Evaluate the integral
$$\int_{-\infty}^{\infty} \frac{1}{(1 + x^2)^{n+1}} dx. $$
I know that it equals $2\pi i$(the sum of the residues; at $z_k$) where $z_k$ are the poles of the function. I can evaluate this without the $n+1$ but that is throwing me for a serious loop.
For this case, consider
$$\oint_C \frac{dz}{(1+z^2)^{n+1}} $$
where $C$ is a semicircle of radius $R$ in the upper half plane. By the residue theorem, the contour integral is equal to $i 2 \pi$ time the residue at the pole $z=i$. Noting that the integral about the semicircle vanishes as $1/R^{2 n+1}$ as $R \to \infty$, we have
$$\int_{-\infty}^{\infty} \frac{dx}{(1+x^2)^{n+1}} = i 2 \pi \operatorname*{Res}_{z=i} \frac{1}{(1+z^2)^{n+1}}$$
Now,
$$\operatorname*{Res}_{z=i} \frac{1}{(1+z^2)^{n+1}} = \frac{1}{n!} \left [\frac{d^n}{dz^n} \frac{1}{(z+i)^{n+1}}\right ]_{z=i} = \frac{(2 n)!}{(n!)^2} \frac{(-1)^n}{(2 i)^{2 n+1}}$$
Therefore
$$\int_{-\infty}^{\infty} \frac{dx}{(1+x^2)^{n+1}} = \frac{\pi}{2^{2 n}} \binom{2 n}{n}$$
For general $\Re n>-\frac{1}{2}$, see Mhenni Benghorbal's answer. However, if $n$ is a nonnegative integer, you can as well substitute $x=\cot\phi$, resulting in $$\int_{-\infty}^\infty \frac{1}{(1+x^2)^{n+1}}\mathrm{d}x = \int_0^\pi\sin^{2n}\phi\,\mathrm{d}\phi \stackrel{(*)}{=} \frac{1}{2}\int_0^{2\pi}\sin^{2n}\phi\,\mathrm{d}\phi$$ and then use this question and answer to calculate the last integral with the residue theorem. Note: the requirement that $n$ be an integer kicks in at (*).
Edit: I propose the above substitution because applying the residue theorem directly in the complex $x$-plane would require partial fraction decompositions depending on $n$ or a series expansion of $(1+x^2)^{-(n+1)}$, both of which is doable but requires more work.
A related technique. Here is an approach. Follow the steps
i)
$$ \int_{-\infty}^{\infty}\frac{dx}{(1+x^2)^{n+1}}dx = 2\int_{0}^{\infty}\frac{dx}{(1+x^2)^{n+1}}dx $$
ii) Change of variables
$$ 1+x^2=\frac{1}{t} $$
iii) Use the $\beta$ function
$$ \mathrm{\beta}(x,y) = \int_0^1t^{x-1}(1-t)^{y-1}\,dt=\frac{\Gamma(x)\Gamma(y)}{\Gamma(x+y)},\quad \textrm{Re}(x), \textrm{Re}(y) > 0.\, $$