Find the residue of $1/(z^2+1)^{n+1}$ at $z=i$. I'm trying to find the residue of $\frac{1}{(z^2+1)^{n+1}}$ at $z=i$.  I believe this should be approached combinatorially but I am getting stuck in the combinatorics.  Here's what I have so far.
$$ \frac{1}{(z^2+1)^{n+1}} = \frac{1}{(z-i)^{n+1}} \cdot \frac{1}{(z-i+2i)^{n+1}} $$
$$ = \frac{1}{(z-i)^{n+1}} \cdot \frac{1}{(2i)^{n+1}(1-[-z+i]/(2i))^{n+1}} $$
$$ = \frac{1}{(z-i)^{n+1}} \cdot \frac{1}{(2i)^{n+1}}\cdot \left[\sum_{k=1}^\infty \left((-z+i)/(2i)\right)^k\right]^{n+1} $$
$$ = \frac{1}{(z-i)^{n+1}} \cdot \frac{1}{(2i)^{n+1}}\cdot \left[\sum_{k=1}^\infty \left(\frac{-1}{2i}\right)^k(z-i)^k\right]^{n+1} $$
To get the residues we want the $(z-i)^{-1}$ term, which we can determine once we know the $(z-i)^n$ term of the factor which is expressed above as a series.  This will come from making $n+1$ choices of a term from each of the $n+1$ copies of the series, such that the exponents sum to $n$.  However, this now gets into a pretty famous combinatorial problem of finding the ways to partition an integer.  That sounds like a lot of tricky combinatorial stuff when you're learning about residues.  Am I doing this the hard way--is there an easier one?

There is agreement between the residue and the integral of $f(x)$ along the real axis.  We show that $$\int_{-\infty}^\infty \frac{dx}{(x^2+a^2)^{n+1}} = \frac{\pi}{2^{2n}a^{2n+1}} \frac{(2n)!}{n!n!}.$$
This is true for $n=0$:
$$\int_{-\infty}^\infty \frac{dx}{x^2+a^2} = \frac{1}{a}\int_{-\infty}^\infty \frac{\frac{dx}{a} }{\left(\frac{x^2}{a^2}+1\right)}=\frac{1}{a} \int_{-\infty}^\infty \frac{dq}{q^2+1}=\frac{1}{a} \left.\tan^{-1} q\right|_{-\infty}^\infty=\frac{\pi}{a}.$$
Assume true for $n-1$ and differentiate with respect to $a$.
$$\frac{d}{da}\int_{-\infty}^\infty \frac{dx}{(x^2+a^2)^{n}} = \frac{d}{da}\left[\frac{\pi}{2^{2n-2}a^{2n-1}} \frac{(2n-2)!}{(n-1)!(n-1)!}\right].$$
$$-2 n a\int_{-\infty}^\infty \frac{dx}{(x^2+a^2)^{n+1}} =-(2n-1)\left[\frac{\pi}{2^{2n-2}a^{2n}} \frac{(2n-2)!}{(n-1)!(n-1)!}\right].$$
$$\int_{-\infty}^\infty \frac{dx}{(x^2+a^2)^{n+1}} =\frac{2n}{2n}\left[\frac{\pi}{2^{2n-1}a^{2n+1}} \frac{(2n-1)!}{n!(n-1)!}\right].$$
$$\int_{-\infty}^\infty \frac{dx}{(x^2+a^2)^{n+1}} =\frac{\pi}{2^{2n}a^{2n+1}} \frac{(2n)!}{n!n!}.$$
With $a=1$,
$$\int_{-\infty}^\infty \frac{dx}{(x^2+1)^{n+1}} =\frac{\pi}{2^{2n}} \frac{(2n)!}{n!n!}=2\pi i \cdot \text{Res}_{z=i}\, f(z).$$
