Prove $$\int^\infty_0 \frac{x^{n-1}}{1+x}dx= \frac{\pi}{\sin(n\pi)}$$
I would like to consider two circles of radii $\epsilon < 1 < R$ centered at the origin and connected by a corridor of width $\delta > 0$. Then I want to choose a branch of the logarithm in $ \mathbb{C}$ \ $[0,\infty]$ and study its behavior on both sides of the corridor. But I don't know how to go about this to get the final result. Any help appreciated!
We want to evaulate $$I=\int_0^\infty \frac{1}{x^a(x+1)}dx$$ where $0<a<1$. Like you suggested we can use a keyhole loop with circles $C,c$ of radius $R,r$ and a corridor of width $\delta$. Call the two sides of the corridor $a,b$. The main idea is to use the branch of the logarithm defined in $\mathbb{C}$ \ $\mathbb{R}_{\ge}$, i.e. we have that $0\le Im (\log(z))<2\pi$. Let's define $$f(z)=\frac{1}{z^a(z+1)}=\frac{1}{e^{a\log z}(z+1)}.$$ Then we have (integrating anti-clockwise) $$\int_C f+\int_c f+\int_a f-\int_{b} f=2\pi i \cdot res_{-1}f(z).$$ The key point is that using this branch of log we have that $$\lim_{y \to 0+}\log(x+iy)=\log x$$ $$\lim_{y \to 0-}\log(x+iy)=\log x+2\pi i.$$ Hence letting $\delta \to 0+$ $$\int_a f=\int_0^\infty\frac{1}{e^{a\log x+i\delta}(x+\delta+1)} dx \to \int_0^\infty\frac{1}{e^{a\log x}(x+1)}dx=I $$ $$\int_b f=\int_0^\infty\frac{1}{e^{a\log x-i\delta}(x-\delta+1)} dx \to \int_0^\infty\frac{1}{e^{a(\log x+2\pi i)}(x+1)}dx=Ie^{-2a\pi i}. $$ You can verify that the integrals on $C$ and $c$ vanish for large $R$ and small $r$ and that $$res_{-1}f(z)=\frac{1}{e^{a\pi i}}.$$ Putting all together we deduce $$0+0+I-Ie^{-a2\pi i}=\frac{2 \pi i}{e^{a\pi i}}$$ and $I=\frac{\pi}{\sin(a\pi)}.$