I came across the following integral in a book (Kato's Perturbation Theory for Linear Operators, $\S$3.5):
$\int_{-\infty}^\infty (a^2+x^2)^{-n/2}\,dx$
where $n$ is a non-negative integer and $a$ is a non-negative real number.
According to WolframAlpha and the book, the answer is
$\frac{\sqrt{\pi}\,\Gamma\left(\frac{n-1}{2}\right)}{a^{n-1}\Gamma\left(\frac{n}{2}\right)}$
I tried converting it into a contour integral (a semi-circle in the upper half-plane) and using the residue theorem, but my answer did not come out correctly. I'm wondering whether I made a calculation error, or whether I'm doing it fundamentally wrong.
Let's see:
$$ \int_{-\infty}^\infty \big(a^2 + x^2\big)^{-\frac{n}{2}} dx = a^{1-n} \int_{-\infty}^\infty \big(1 + x^2\big)^{-\frac{n}{2}} dx = \frac{2}{a^{n-1}} \int_0^\infty \big(1 + x^2\big)^{-\frac{n}{2}} dx $$
Now, the Beta Function $$ \text{B}(\xi,\eta) = \frac{\Gamma(\xi)\Gamma(\eta)}{\Gamma(\xi+\eta)} $$
has the known integral representation${}^1$
$$ \text{B}(\xi,\eta) = \int_0^\infty \frac{t^{\xi-1}}{(1 + t)^{\xi+\eta}} dx $$
so
$$ \int_0^\infty \big(1 + x^2\big)^{-\frac{n}{2}} dx = \frac{1}{2} \int_0^\infty \frac{t^{-1/2}}{(1 + t)^{n/2}} dt $$
\begin{align} \xi - 1 &= -\tfrac{1}{2}\\ \xi + \eta &= \tfrac{n}{2} \end{align}
hence $\xi = \frac{1}{2}$ and $\eta = \frac{n - 1}{2}$. Then
$$ \int_{-\infty}^\infty \big(a^2 + x^2\big)^{-\frac{n}{2}} dx = \frac{1}{a^{n-1}} \frac{\Gamma\left(\tfrac{1}{2}\right)\Gamma\left(\tfrac{n - 1}{2}\right)}{\Gamma\left(\tfrac{n}{2}\right)} = \frac{\sqrt{\pi} \, \Gamma\left(\tfrac{n - 1}{2}\right)}{a^{n-1} \Gamma\left(\tfrac{n - 1}{2}\right)} $$
${}^1$ See Lebedev's Special Functions & Their Applications for details.