4. Let the $n$ roots of the equation $x^{n}=1$ (where $n$ is an odd number) be $1, x_{1}, x_{2}, \cdots, x_{n-1}$. Then $\sum_{i=1}^{n-1} \frac{1}{1+x_{i}}=$ $\qquad$ .
4. $\frac{n-1}{2}$.

From $x^{n}=1$ we know $\bar{x}^{n}=1$, meaning the conjugate of the roots of $x^{n}=1$ are also its roots. Therefore, 1, $\bar{x}_{1}, \bar{x}_{2}, \cdots, \bar{x}_{n-1}$ are also the $n$ roots of $x^{n}=1$, and $\left|x_{i}\right|=1$. Thus,
$$
\begin{array}{l}
x_{i} \bar{x}_{i}=1, i=1,2, \cdots, n-1 . \\
\text { Hence } a=\sum_{i=1}^{n-1} \frac{1}{1+x_{i}}=\sum_{i=1}^{n-1} \frac{x_{i} \bar{x}_{i}}{x_{1} \bar{x}_{i}+x_{i}} \\
=\sum_{i=1}^{n-1} \frac{\bar{x}_{i}}{\bar{x}_{i}+1}=\sum_{i=1}^{n-1}\left(1-\frac{1}{1+\bar{x}_{i}}\right) \\
=(n-1)-\sum_{i=1}^{n-1} \frac{1}{1+\bar{x}_{i}}=(n-1)-a .
\end{array}
$$

Therefore, $a=\frac{n-1}{2}$.