<s>[INST] Is there an elementary proof for $\int_{0}^{\infty} \frac{d x}{x^{n}+1}= \frac{\pi}{n} \csc \left(\frac{\pi}{n}\right) $ When I first encounter the integral
$$\int_{0}^{\infty} \frac{d x}{x^{n}+1},$$
I am trying to resolve the integrand into partial fractions. Then I found it is very tedious and complicated and look for infinite series.
I first split the integral into 2 parts.
$$
\begin{aligned}
\int_{0}^{\infty} \frac{d x}{x^{n}+1} =& \underbrace{\int_{0}^{1} \frac{d x}{x^{n}+1}}_{J}  +\underbrace{\int_{1}^{\infty}\frac{d x}{x^{n}+1}}_{K}
\end{aligned}
$$
$$
\begin{aligned}
J &=\int_{0}^{1} \sum_{k=0}^{\infty}(-1)^{k} x^{n k} d x =\sum_{k=0}^{\infty}\left[\frac{(-1)^{k} x^{n k+1}}{n k+1}\right]_{0}^{1} =\sum_{k=0}^{\infty} \frac{(-1)^{k}}{n k+1}=\frac{1}{n} \sum_{k=0}^{\infty} \frac{(-1)^{k}}{k+\frac{1}{n}}
\end{aligned}
$$
Similarly,
$$
\begin{aligned}
K&=\int_{1}^{\infty} \frac{1}{x^{n}+1} d x =\int_{1}^{\infty} \frac{x^{-n}}{1+x^{-n}} d x =\int_{1}^{\infty} x^{-n} \sum_{k=0}^{\infty}(-1)^{k}x^{-k n} d x=\sum_{k=0}^{\infty} \frac{(-1)^{k+1}}{-(k+1) n+1} \end{aligned}$$
Rearranging and re-indexing yields
$$K=\frac{1}{n} \sum_{k=0}^{\infty} \frac{(-1)^{k+1}}{-(k+1)+\frac{1}{n}}=\frac{1}{n} \sum_{k=-1}^{-\infty} \frac{(-1)^{k}}{k+\frac{1}{n}}
$$
Grouping $J$ and $K$ yields $$\int_{0}^{\infty} \frac{d x}{x^{n}+1} =\frac{1}{n}\left(\sum_{k=0}^{\infty} \frac{(-1)^{k}}{k+\frac{1}{n}}+\sum_{k=-1}^{-\infty} \frac{(-1)^{k}}{k+\frac{1}{n}}\right) $$
Using the theorem
$$
\pi \csc (\pi \alpha)=\lim _{N \rightarrow \infty} \sum_{k=-N}^{N} \frac{(-1)^{k}}{k+\alpha}
$$
and putting $\alpha=\frac{1}{n}$ yields
$$\int_{0}^{\infty} \frac{d x}{x^{n}+1}=\frac{\pi}{n} \csc \left(\frac{\pi}{n}\right).$$
My question: Is there any elementary proof?
 [/INST] Here is an elementary proof using partial fractions, avoiding complex analysis, infinite series, or special functions commonly employed to evaluate this integral
\begin{align}
& \int_{0}^{\infty} \frac{1}{1+x^{n}} dx\\
=&\int_{0}^{1} \frac{1}{1+x^{n}}dx+ \int_{1}^{\infty} \frac{1}{1+x^{n}}\overset{x\to 1/x}{dx }
= \int_{0}^{1} \frac{1+x^{n-2}}{1+x^{n}}dx \\
=& \int_0^1 \sum_{k=0}^{n-1} \frac{\frac2n \sin^2 \frac{(1+2k)\pi}n}{x^2-2x \cos \frac{(1+2k)\pi}n +1 }\ dx
=-\sum_{k=0}^{n-1} \frac{2\pi k}{n^2} \sin \frac{(1+2k)\pi}n\\
=& \ \frac d{da}\bigg(\sum_{k=0}^{n-1} \frac1n \cos \frac{(1+2k)\pi a}n \bigg)_{a=1}
=\frac d{da}\bigg(\frac{\sin 2\pi a}{2n\sin\frac{\pi a}n} \bigg)_{a=1}
=\frac{\pi}{n} \csc \frac{\pi}{n}
\end{align}
</s>