I have questions about 2 integral identities that are used often.
1) Following this thread: complex keyhole contour integral $\int_0^\infty \frac{x^{p-1}}{1+x^{2}} \, dx$, Mark Viola states that ($0<p<2$) $$\int_{-\infty}^\infty \frac{x^{p-1}}{1+x^2}\,dx =(1+e^{i(p-1)\pi})\int_0^\infty \frac{x^{p-1}}{1+x^2}\,dx \tag1$$
if I let $p=1$, then it is clear, because $1/(1+x^2)$ is even and we would be having
$$\int_{-\infty}^\infty \frac{x^{0}}{1+x^2}\,dx =2\int_0^\infty \frac{x^{0}}{1+x^2}\,dx \tag2$$
but how can I prove/see that the general case in (1) holds?
and also this: Closed form for $ \int_0^\infty {\frac{{{x^n}}}{{1 + {x^m}}}dx }$ (robjohn) ($0<\alpha<1$) \begin{align} \int_0^\infty\frac{x^{\alpha-1}}{1+x}\,\mathrm{d}x &=\int_0^1\frac{x^{-\alpha}+x^{\alpha-1}}{1+x}\,\mathrm{d}x \tag3\\ \\ \end{align}
If someone could show to me how one can derive the formulae of (1) and (3) I would be really thankful.
(since they are similar I put them both in one question, hope that it is fine.)