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?
 A: If we write $$g(z) = g(z_0)+g^\prime(z_0)(z-z_0) + g^{\prime \prime}(z_0)(z-z_0)^2 + \cdots$$ then $$\frac{g(z)}{(z-z_0)^{n+1}}= \frac{g(z_0)}{(z-z_0)^{n+1}}+\cdots+\frac{g^{(n)}(z_0)}{n!\,(z-z_0)}+ \frac{g^{(n+1)}(z_0)}{(n+1)!}+\frac{g^{(n+2)}(z_0)}{(n+2)!}(z-z_0)+\cdots,$$ so if $g(z)$ does not have poles or zeros at $z=z_0$, and $$\bbox[5px, border: 1pt solid green]{f(z)=\frac{g(z)}{(z-z_0)^{n+1}},}$$ then the residue of $f(z)$ at $z=z_0$ is $$\bbox[5px, border: 1pt solid blue]{\text{Res}_{z=z_0}f(z) = \frac{g^{(n)}(z_0)}{n!}.}$$
We have
$$\bbox[5px, border: 1.5pt solid green]{ f(z) = \frac{1}{(z+i)^{n+1}} \frac{1}{(z-i)^{n+1}}=\frac{g(z)}{(z-i)^{n+1}}}$$The residue of $f(z)$ at $z=i$ is thus
$$\bbox[5px, border: 1.5pt solid blue]{\text{Res}_{z=i} f(z) = \frac{ g^{(n)}(i)}{n!} = \frac{1}{i}\frac{(2n)!}{n!n!}\frac{1}{2^{2n+1}}.}$$
Here is one way of computing the derivatives $\cdots$
$$g(z) = (z+i)^{-n-1}$$
$$g^\prime(z) = -(n+1) (z+i)^{-n-2}$$
$$g^{\prime\prime}(z) = (-1)^2 (n+1) (n+2) (z+i)^{-n-3}$$
$$\cdots$$
$$g^{(n)}(z) = (-1)^n \frac{(2n)!}{n!}(z+i)^{-2n-1}$$
$$g^{(n)}(i) = \frac{(2n)!}{n!} \frac{2^{-2n-1}}{i}$$
A: 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).$$
