How can we evaluate the integral $\int_{0}^{\infty} \frac{d x}{1+x+x^{2}+\ldots+x^{n-1}}$, where $n\geq 3$? We are going to investigate the integral
$$
I_{n}=\int_{0}^{\infty} \frac{d x}{1+x+x^{2}+\ldots+x^{n-1}} \text {, where } n \geqslant 3.
$$
Let’s start with the simpler cases.
$$
\begin{aligned}
I_{3} &=\int_{0}^{\infty} \frac{d x}{1+x+x^{2}} \\
&=\int_{0}^{\infty} \frac{d x}{\left(x+\frac{1}{2}\right)^{2}+\left(\frac{\sqrt{3}}{2}\right)^{2}} \\
&=\frac{2}{\sqrt{3}}\left[\tan ^{-1}\left(\frac{2 x+1}{\sqrt{3}}\right)\right]_{0}^{\infty} \\
&=\frac{2}{\sqrt{3}}\left(\frac{\pi}{2}-\frac{\pi}{6}\right) \\
&=\frac{2 \pi}{3 \sqrt{3}}
\end{aligned}
$$
and
$$
\begin{aligned}
I_{4} &=\int_{0}^{\infty} \frac{1}{(1+x)\left(1+x^{2}\right)} d x \\
&=\frac{1}{2} \int_{0}^{\infty}\left(\frac{1}{x+1}+\frac{1-x}{x^{2}+1}\right) d x \\
&=\frac{1}{2}\left[\ln (x+1)+\tan ^{-1} x-\frac{1}{2} \ln \left(x^{2}+1\right)\right]_{0}^{\infty} \\
&=\frac{1}{4}\left[\ln \frac{(x+1)^{2}}{x^{2}+1}\right]_{0}^{\infty}+ \left[\frac{1}{2} \tan ^{-1} x\right]_{0}^{\infty} \\
&=\frac{\pi}{4}
\end{aligned}
$$
But the integrals are difficult when $n\geq 5$.
My question: Is there any elementary method to evaluate it?
Your suggestions and solutions are warmly welcome.

Multiplying both numerator and denominator by $1-x$ converts the integral
$I_n:=\displaystyle \int_{0}^{\infty} \frac{1-x}{1-x^{n}} d x ,\textrm{ where }n\geq 3\tag*{} \\$
We shall evaluate the integral by the theorem
$ \displaystyle \sum_{k=-\infty}^{\infty} \frac{1}{k+z}=\pi \cot (\pi z), \textrm{ where } z\notin Z.\tag*{} $
We first split the integral into 2 integrals
$ \displaystyle \int_{0}^{\infty} \frac{1-x}{1-x^{n}} d x=\int_{0}^{1} \frac{1-x}{1-x^{n}} d x+\int_{1}^{\infty} \frac{1-x}{1-x^{n}} d x \tag*{}$
Transforming the latter integral by the inverse substitution $ x\mapsto \frac{1}{x} $,
we have
$$ \int_{1}^{\infty} \frac{1-x}{1-x^{n}} d x=\int_{0}^{1} \frac{x^{n-3}-x^{n-2}}{1-x^{n}} d x \tag*{} $$
Combining them and expanding the denominator into power series yields
$$ \begin{aligned} I_n&=\int_{0}^{1} \frac{1-x+x^{n-3}-x^{n-2}}{1-x^{n}} d x\\ &=\int_{0}^{1}\left[\left(1-x+x^{n-3}-x^{n-2}\right) \sum_{k=0}^{\infty} x^{n k}\right] d x\\ &=\sum_{k=0}^{\infty} \int_{0}^{1}\left[x^{n k}-x^{n k+1}+x^{n(k+1)-3}-x^{n(k+1)-2}\right] d x\\ &=\sum_{k=0}^{\infty}\left(\frac{1}{n k+1}-\frac{1}{n k+2}+\frac{1}{n(k+1)-2}-\frac{1}{n(k+1)-1}\right)\\ &=\sum_{k=0}^{\infty}\left[\frac{1}{n k+1}-\frac{1}{n(k+1)-1}\right]+\sum_{k=0}^{\infty}\left[\frac{1}{n(k+1)-2}-\frac{1}{n k+2}\right]\\ &=\frac{1}{n}\left[\sum_{k=0}^{\infty} \frac{1}{k+\frac{1}{n}}+\sum_{k=-1}^{-\infty} \frac{1}{k+\frac{1}{n}}\right]+\frac{1}{n}\left(\sum_{k=1}^{\infty} \frac{1}{k-\frac{2}{n}}+\sum_{k=0}^{-\infty} \frac{1}{k-\frac{2}{n}}\right)\\ &=\frac{1}{n}\left(\sum_{k=-\infty}^{\infty} \frac{1}{k+\frac{1}{n}}+\sum_{k=-\infty}^{\infty} \frac{1}{k-\frac{2}{n}}\right)  \end{aligned}$$
Recall the Theorem,
$\displaystyle  \sum_{k=-\infty}^{\infty} \frac{1}{k+z}=\pi \cot (\pi z), \tag*{} $
where $ z\notin Z.$
We can now conclude that
$\displaystyle \boxed{ I_n =\frac{1}{n}\left[\pi \cot \left(\frac{\pi}{n}\right)+\pi \cot \left(\frac{-2 \pi}{n}\right)\right]=\frac{\pi}{n}\left[\cot \left(\frac{\pi}{n}\right)-\cot \left(\frac{2 \pi}{n}\right)\right] =\frac{\pi}{n} \csc \frac{2 \pi}{n}} \tag*{} $
By the way, is there any other elementary method?
