# Contour integration and the central binomial coefficients

I am trying to compute the integral $$\int_{-\infty}^\infty \frac{x^{2n}}{(x^2 + 1)^{n + 1}}\ dx.$$ From computational evidence, it's very obvious that $$\int_{-\infty}^\infty \frac{x^{2n}}{(x^2 + 1)^{n + 1}}\ dx = \frac{\pi}{4^n} {2n \choose n}.$$ Indeed, I can prove this via the generating function for the central binomial coefficients.

However, I want to prove this via contour integration. With $$f(z) = z^{2n} / (z^2 + 1)^{n + 1}$$, we can integrate over the semicircle of radius $$R$$ in the upper half-plane. Call this contour $$\gamma_R$$. The integral over the arc of $$\gamma_R$$ goes to zero as $$R \to \infty$$, which leaves $$\int_{-\infty}^\infty \frac{x^{2n}}{(x^2 + 1)^{n + 1}}\ dx = 2\pi i \operatorname{res}_i f.$$ The residue of $$f$$ at $$i$$ is $$g^{(n)}(i) / n!$$, where $$g(z) = \frac{z^{2n}}{(z + i)^{n + 1}}.$$ Thus, we should have $$g^{(n)}(i) = \frac{-i n! {2n \choose n}}{2^{2n + 1}}.$$

How can I show that this equality holds? Or, more generally, How can I compute the residue of $$f$$ at $$i$$?

I tried using the series $$\frac{1}{(1 - z)^{n + 1}} = \sum_{k \geq 0} {k + n \choose k} z^k,$$ but couldn't really make it work.

Edit: I was asked to explain why my evaluation is "obvious." This is from using a computer algebra system to directly evaluate $$g^{(n)}(i)$$ for a few dozen $$n$$. This gives some rational expressions which, when looked up in the OEIS, suggest the closed form I have given here. Then it is a trivial matter to estimate the integral numerically and compare it for hundreds of terms.

$$\frac{1}{n!} \left(z^{2n} \frac{1}{(z+i)^{n+1}} \right)^{(n)} \\ = \frac{1}{n!} \sum_{q=0}^n {n\choose q} \frac{(2n)!}{(2n-q)!} z^{2n-q} (-1)^{n-q} \frac{(n+n-q)!}{n!} \frac{1}{(z+i)^{n+1+n-q}} \\ = {2n\choose n} \sum_{q=0}^n {n\choose q} z^{2n-q} (-1)^{n-q} \frac{1}{(z+i)^{2n+1-q}} \\ = {2n\choose n} \frac{z^{2n}}{(z+i)^{2n+1}} \sum_{q=0}^n {n\choose q} (-1)^{n-q} \frac{(z+i)^q}{z^q} \\ = {2n\choose n} \frac{z^{2n}}{(z+i)^{2n+1}} \left(\frac{z+i}{z} - 1\right)^n \\ = {2n\choose n} \frac{i^n z^{n}}{(z+i)^{2n+1}}.$$
Returning to the main computation we set $$z=i$$ to obtain
$$2\pi i \times {2n\choose n} \frac{i^{2n}}{(2i)^{2n+1}} \\= 2\pi i \times {2n\choose n} \frac{1}{2^{2n+1}} \frac{1}{i} = \frac{\pi}{4^{n}} {2n\choose n}.$$