Show that $\int _0 ^\infty \frac{x^{p-1}}{1+x} dx=\frac{\pi}{sin(p \pi)}, 0This is a complex analysis question, I tried to find the residue of the integrand at x=0, which equal to $x^p=0$. So it looks the integral naively equal to $0$. What did I do wrong?
 A: basicly it comes from this theorm:
Theorom : $\displaystyle \int_0^\infty  {x^m\over{x^n+1}}dx={{\pi \over n} \over sin(m+1({\pi \over n })) },n-m \ge2$
Proof:
using contour integral we can write :
$$\oint_C {z^m \over {z^n+1}} \,dz$$
if $C$ choosed ppropriately The integrand has n first-order singularities,at the $n$ $n$-th roots of $-1$,these singular points are uniformly spaced around
the unit circle in the complex plane. thus using euler formula we can write:
$$ -1=e^{i(1+2k)\pi}$$
singular points are located at:
$$ z_k=(-1)^{1 \over n}=e^{i({{1+2k} \over n})\pi},k=0,1,2,3,...,n-1 $$
for other values of k these same n points simply repeat.
now focus on one of these singular points , $k=0$.
pick C to enclose just that one singularity, at $z=z_0=e^{i{\pi \over n}}$

so the central angle of the wedge is $2\pi \over n$ and the singularity is at half that $\pi \over n$.
contour’s three portions are:
$$ C_1=z=x,dz=dx,0 \le x \le T $$
$$ C_2=z=Te^{i\theta},dz=iTe^{i\theta}d\theta,0 \le x \le {2\pi \over n} $$
$$ C_3=z=re^{{i2\pi}\over n},dz=e^{{i2\pi}\over n}dr,0 \le r \le T $$
so:
$$ \oint_C {z^m \over {z^n+1}} \,dz= \int_0^T {x^m \over {x^n+1}}dx + \int_0^{2\pi \over n} {(Te^{i\theta})^m \over {(Te^{i\theta})^n+1}}iTe^{i\theta}d\theta+ \int_T^0 {(re^{{i2\pi}\over n})^m \over {(re^{{i2\pi}\over n})^n+1}}e^{{i2\pi}\over n}dr$$
$$=\int_0^T {x^m \over {x^n+1}}dx- \int_0^T { {r^me^{i(m+1){2\pi \over n}}} \over {r^n+1} }dr + \int_0^{2\pi \over n}{ {T^{m+1}e^{im\theta}} \over {T^{n}e^{in\theta}+1} }ie^{i\theta}d\theta $$
now clearly as $T \to \infty$ the $\theta$-integral goes to zero because $m+1<n$ also
$$\int_0^T { {r^me^{i(m+1){2\pi \over n}}} \over {r^n+1} }dr=e^{i(m+1){2\pi \over n}} \int_0^T {x^m \over {x^n+1}}dx $$
so as $T \to \infty$:
$$\oint_C {z^m \over {z^n+1}} \,dz=\int_0^\infty {x^m \over {x^n+1}}dx(1-e^{i(m+1){2\pi \over n}})$$
or as :
$$(1-e^{i(m+1){2\pi \over n}})=-2isin((m-1){\pi \over n})e^{i(m+1){2\pi \over n}}$$
we have:
$$\oint_C {z^m \over {z^n+1}} \,dz=-2isin((m=1){\pi \over n})e^{i(m+1){2\pi \over n}}\int_0^\infty {x^m \over {x^n+1}}dx $$
since we can write the integrand of the contour integral as a partial fraction
expansion:
$$ {z^m \over {z^n+1}}={N_0 \over {z-z_0}}+{N_1 \over {z-z_1}}+...+{N_{n-1} \over {z-z_{n-1}}} $$
where the $N$'s are constants.integrating this expansion term-by-term:
$$ \oint_C {z^m \over {z^n+1}} \,dz=N_0\oint_C {dz \over {z-z_0}} $$
using cauchy’s first integral theorem all the other integrals are zero ,so the only singularity $C$ is $z_0$ ,now using cauchy’s second integral theorem with $f(z)=1$ we get:
$$ -2isin((m=1){\pi \over n})e^{i(m+1){2\pi \over n}}\int_0^\infty {x^m \over {x^n+1}}dx=2\pi iN_0 $$
and final step is calculate $N_0$:
$$ {(z-z_0)z^m \over {z^n+1}}=N_0+{N_1(z-z_0) \over {z-z_1}}+... $$
and if $z \to z_0$ then:
$$ N_0=lim_{z \to z_0} {(z-z_0)z^m \over {z^n+1}}={0 \over 0} $$
thus using L’Hoˆpital’s rule:
$$ N_0=lim_{z \to z_0} {(z-z_0)z^m \over {z^n+1}}={z_0^{m-n+1} \over n} $$
using $z_0=e^{i\pi \over n}$:
$$ N_0=-{e^{i( {m+1 \over n} )\pi} \over n } $$ 
inserting this to result we finally get :
$$ \bbox[5px,border:2px solid red]
{
\displaystyle \int_0^\infty  {x^m\over{x^n+1}}dx={ {2\pi i}(-{e^{i( {m+1 \over n} )\pi} \over n }) \over {-2isin((m-1){\pi \over n})e^{i(m+1){2\pi \over n}}} } 
}
$$
now in order to calculate what you asked:
define $t=x^n$ then :
$${dt \over dx} = nx^{n-1} $$ so :
$$\int_0^\infty { t^{{m} \over n} \over t+1} ({dt \over nt^{{n-1}\over n} })=\int_0^\infty { t^{{{m+1} \over n}-1} \over {t+1}}dt $$
now define $$a={{m+1} \over n} $$ and finally get($0<a<1$):
$$ \bbox[5px,border:2px solid green]
{
\displaystyle \int_0^\infty  {x^{a-1}\over{x+1}}dx= {\pi \over sin(a\pi)}
}
$$
