I am recently investigating integrals with rational integrand such as $$ \int_{0}^{\infty} \frac{P(x)}{\left(x^{m}+1\right)^{n}} d x, $$ where $P(x)$ is a polynomial, $m$ and $n$ are natural numbers.
After trying several methods, I realize that I have to prove a fundamental integral
$$\int_{0}^{\infty} \frac{x^{r}}{x^{m}+1} d x=\frac{\pi}{m} \csc \frac{(r+1) \pi}{m},$$
where $m>r+1>0$. When I tried to evaluate it by Gamma and Beta functions, I eventually need the Euler Reflection Theorem to complete the proof.
My question: Is there an elementary proof for the integral?
Your proofs and suggestions are highly appreciated.
Letting $\displaystyle \frac{1}{t}=x^{m}+1$, then $ \displaystyle d x=\frac{1}{m} \left(\frac{1}{t}-1\right)^{\frac{1}{m}-1}\left(-\frac{1}{t^{2}}\right) d t. $
Consequently $$ \begin{aligned} \int_{0}^{\infty} \frac{x^{r}}{x^{m}+1} d x &=-\int_{1}^{0} \frac{\left(\frac{1}{t}-1\right)^{\frac{r}{m}}}{\frac{1}{t}} \frac{1}{m t^{2}}\left(\frac{1}{t}-1\right)^{\frac{1}{m}-1} d t \\ &=\frac{1}{m} \int_{0}^{1} \frac{(1-t)^{\frac{r}{m}}(1-t)^{\frac{1}{m}-1}}{t^{\frac{r+1}{m}}} d t \\ &=\frac{1}{m} \int_{0}^{1} t^{-\frac{r+1}{m}}(1-t)^{\frac{r+1}{m}-1} d t \\ &=\frac{1}{m} B\left(1-\frac{r+1}{m}, \frac{r+1}{m}\right) \end{aligned} $$ By the property of Beta function,
$$ B(x, y)=\frac{\Gamma(x) \Gamma(y)}{\Gamma(x+y)}, $$ where $\operatorname{Re}(x)>0$ and $\operatorname{Re}(y)>0,$
we have $$ \int_{0}^{\infty} \frac{x^{r}}{x^{m}+1} d x=\frac{\Gamma\left(1-\frac{r+1}{m}\right) \Gamma\left(\frac{r+1}{m}\right)}{m\Gamma(1)} $$
Using the Euler’s Reflection Theorem,
$$ \Gamma(1-z) \Gamma(z)=\pi \csc (\pi z), $$
where $z\notin Z$,
we can now conclude that $$\boxed{\int_{0}^{\infty} \frac{x^{r}}{x^{m}+1} d x=\frac{\pi}{m} \csc \frac{(r+1) \pi}{m}}$$