contour integration $\int_0^\infty \frac{dx}{x^p(x^2+2x\cos{\phi}+1)}$ I'm supposed to verify that this:
$$\int_0^\infty \frac{dx}{x^p(x^2+2x\cos{\phi}+1)}=\pi\frac{\sin{p\phi}}{\sin{p\pi}\sin{\phi}}$$
where $0<p<1$ and $0<\phi<\pi$
How do I do this with a keyhole contour?
 A: The basic procedure is very simple. Suppose we are using the standard keyhole contour of radius $R$ and with the branch cut of the logarithm along the positive real axis and its argument between $0$ and $2\pi.$
Let $$f(x) = \frac{e^{-p \log x}}{x^2+ 2x\cos\phi+1}$$ and let $I$ be the integral we are looking for. Writing
$$ I = \int_0^\infty f(x) dx = \int_0^\infty \frac{e^{-p \log x}}{x^2+ 2x\cos\phi+1} dx$$ 
and integrating counterclockwise we see that the segment just above the real axis goes to $I,$ and the one below to $-I e^{-2\pi i p}.$ 
Now note that the only additional two poles are at
$$ \rho_{0,1} = -\cos\phi \pm \sqrt{\cos^2\phi -1} =
-\cos\phi \pm i\sin\phi = - e^{\mp i\phi} = e^{\pi i} e^{\mp i\phi}.$$
It follows by the Cauchy Residue Theorem that
$$ I \left(1- e^{-2\pi i p} \right) = 2\pi i
\left(\operatorname{Res}_{x=\rho_0} f(x) + \operatorname{Res}_{x=\rho_1} f(x)\right).$$
By definition we have
$$ \operatorname{Res}_{x=\rho_0} f(x) =
\lim_{x\to\rho_0} \frac{x^{-p}}{x-\rho_1} =
\frac{e^{-\pi i p} e^{p i\phi}}{2i\sin\phi} $$
and
$$ \operatorname{Res}_{x=\rho_1} f(x) =
\lim_{x\to\rho_1} \frac{x^{-p}}{x-\rho_0} =
-\frac{e^{-\pi i p} e^{-p i\phi}}{2i\sin\phi} $$
Putting it all together, we find
$$I \left(1 - e^{-2\pi i p} \right) = 2\pi i \,
e^{-\pi i p} \frac{e^{p i\phi} - e^{-p i\phi}}{2i\sin\phi} =
2\pi i \, e^{-\pi i p} \frac{\sin (p\phi)}{\sin\phi}$$
or
$$ I =
\frac{2\pi i \, e^{-\pi i p}}{1 - e^{-2\pi i p}} \frac{\sin (p\phi)}{\sin\phi} =
\frac{2\pi i}{e^{\pi i p} - e^{-\pi i p}} \frac{\sin (p\phi)}{\sin\phi} =
\frac{\pi}{\sin(\pi p)}  \frac{\sin (p\phi)}{\sin\phi}.$$
It remains to verify that the integral along the outer circle of radius $R$ disappears as $R$ goes to infinity. But $f(x)$ is $O(1/R^{2+p})$ so the integral is $O(1/R^{1+p})$ which disappears as claimed.
