Detect my mistake: $\int_{-\infty}^{\infty}\frac{dx}{(x^{2}+4)^{n}}$ Detect my mistake:
$\displaystyle\int_{-\infty}^{\infty}
\frac{{\rm d}x}{\left(x^{2} + 4\right)^{n}}\ $.
My try:

*

*We shall take a half circle around the upper part of the plane.

*The arc will tend to zero.

*Now we should calculate residue:
$\displaystyle%
\frac{\left(x - 2{\rm i}\right)^{n}}
{\left(x^{2} + 4\right)^{n}} =
\frac{1}{\left(x + 2{\rm i}\right)^{n}}$.

*We shall take $\left(n - 1\right)$ derivatives:
$$
\frac{\partial^{n - 1}}{\partial x^{n - 1}}
\left[\frac{1}{\left(x + 2{\rm i}\right)^{n}}\right] =
\frac{\left(2n - 2\right)!}{n!\left(x + 2{\rm i}\right)}
= \frac{\left(2n - 2\right)!}{n!\left(4{\rm i}\right)}.
$$
Now the residue is incorrect, which leads to the integral result to be incorrect.

Does anyone see my mistake $?$.
 A: $$I=\int_{-\infty}^\infty\frac{dx}{(x^2+4)^n}$$
$x=2u\Rightarrow dx=2du$
$$I=\int_{-\infty}^\infty\frac{2du}{(4u^2+4)^n}=2^{1-2n}\int_{-\infty}^\infty\frac{du}{(u^2+1)^n}=2^{2(1-n)}\int_0^\infty\frac{du}{(u^2+1)^n}$$
now try making the substitution $u=\tan t\Rightarrow du=\sec^2t\,dt$ so:
$$I=2^{2(1-n)}\int_0^{\pi/2}\frac{\sec^2 t\,dt}{(\sec^2 t)^n}$$
now use the fact that:
$$(\sec^2t)^{-n}=(\cos^2t)^n$$
so we have:
$$I=2^{2(1-n)}\int_0^{\pi/2}\cos^{n-2}(t)dt$$
now you can use the beta function
A: As @leoli noted,$$\frac{d^{n-1}}{dx^{n-1}}(x+2i)^{-n}=(-n)(-n-1)\cdots(-(2n-2))(x+2i)^{-(2n-1)},$$i.e. you shifted the exponent the wrong way. So the integral is$$\begin{align}\frac{2\pi i}{(n-1)!}\lim_{x+2i}\left.\frac{d^{n-1}}{dx^{n-1}}(x+2i)^{-n}\right|_{x=2i}&=\frac{2\pi i(-1)^{n-1}(2n-2)!}{(n-1)!^2}\left.(x+2i)^{1-2n}\right|_{x=2i}\\&=\frac{(2n-2)!2\pi}{(n-1)^24^{2n-1}}.\end{align}$$
A: Real Approach Using Beta Functions (as a verification)
$$
\begin{align}
\int_{-\infty}^\infty\frac{\mathrm{d}x}{(x^2+4)^n}
&=\frac2{4^n}\int_{-\infty}^\infty\frac{\mathrm{d}x}{(x^2+1)^n}\tag1\\
&=\frac1{2^{2n-1}}\int_0^\infty\frac{\mathrm{d}x}{x^{1/2}(x+1)^n}\tag2\\
&=\frac1{2^{2n-1}}\frac{\color{#C00}{\Gamma\!\left(\frac12\right)}\color{#090}{\Gamma\!\left(n-\frac12\right)}}{\color{#00F}{\Gamma(n)}}\tag3\\
&=\frac1{2^{2n-1}}\frac{\color{#C00}{\sqrt\pi}\color{#090}{(2n-2)!\sqrt\pi}}{\color{#00F}{(n-1)!}\color{#090}{2^{2n-2}(n-1)!}}\tag4\\
&=\frac\pi{2^{4n-3}}\binom{2n-2}{n-1}\tag5
\end{align}
$$
Explanation:
$(1)$: substitute $x\mapsto2x$
$(2)$: substitute $x\mapsto\sqrt{x}$
$(3)$: apply the Beta function integral
$(4)$: apply $\Gamma\!\left(n+\frac12\right)=\frac{(2n)!\sqrt\pi}{4^nn!}$
$(5)$: collect factorials into a binomial coefficient

Contour Approach Using Residues (computes the residue)
$$\newcommand{\Res}{\operatorname*{Res}}
\begin{align}
\Res_{x=2i}\left(\frac1{(x-2i)^n}\frac1{(x+2i)^n}\right)
&=\color{#C00}{\left[(x-2i)^{-1}\right]\frac1{(x-2i)^n}}\color{#090}{\frac1{(x-2i+4i)^n}}\tag6\\
&=\color{#C00}{\left[(x-2i)^{n-1}\right]}\color{#090}{\left(1+\frac{x-2i}{4i}\right)^{-n}\frac1{(4i)^n}}\tag7\\
&=\binom{-n}{n-1}\frac1{(4i)^{n-1}}\frac1{(4i)^n}\tag8\\
&=(-1)^{n-1}\binom{2n-2}{n-1}\frac1{(4i)^{2n-1}}\tag9\\
&=\frac{-i}{4^{2n-1}}\binom{2n-2}{n-1}\tag{10}
\end{align}
$$
Thus, the integral around the contour $[-R,R]\cup Re^{i[0,\pi]}$ for $R\gt2$ is
$$
2\pi i\frac{-i}{4^{2n-1}}\binom{2n-2}{n-1}=\frac{\pi}{2^{4n-3}}\binom{2n-2}{n-1}\tag{11}
$$
which is the integral we want because the integral around the semi-circle tends to $0$.
Note that $(6)$ and $(7)$ show that the residue is the coefficient of $(x-2i)^{n-1}$ in $\frac1{(x+2i)^n}$. This is
$$
\frac1{(n-1)!}\left(\frac{\mathrm{d}}{\mathrm{d}x}\right)^{n-1}\frac1{(x+2i)^n}\tag{12}
$$
which is the same quantity that is being computed in the question. Using the generalized binomial theorem, which can be proven by taking derivatives of $(x+2i)^{-n}$, is just a simplification.
