30. (Training Team) Given a positive integer $n \geqslant 2$ and a positive real number $a$, positive real numbers $x_{1}, x_{2}, \cdots, x_{n}$ satisfy $\prod_{i=1}^{n} x_{i}=1$. Find the smallest real number $M=M(n, a)$, such that
$$\sum_{i=1}^{n} \frac{1}{a+S-x_{i}} \leqslant M$$

always holds, where $S=x_{1}+x_{2}+\cdots+x_{n}$.
Let $x_{i}=y_{i}^{n}, y_{i}>0$, then $y_{1} y_{2} \cdots y_{n}=1, i=1,2, \cdots, n$. By the power mean and the arithmetic mean inequality, we have
$$S-x_{i}=\sum_{j \neq i} y_{j}^{n} \geqslant(n-1)\left(\frac{\sum_{j \neq i} y_{j}}{n-1}\right)^{n} \geqslant(n-1)\left(\frac{\sum_{j \neq i} y_{j}}{n-1}\right) \prod_{j \neq i} y_{j}=\frac{\sum_{j \neq i} y_{j}}{y_{i}}$$

Thus,
$$\sum_{i=1}^{n} \frac{1}{a+S-x_{i}} \leqslant \sum_{i=1}^{n} \frac{y_{i}}{a y_{i}+\sum_{j \neq i}^{n} y_{j}}$$

When $a=1$,
$$\sum_{i=1}^{n} \frac{y_{i}}{a y_{i}+\sum_{j \neq i}^{n} y_{j}}=\sum_{i=1}^{n} \frac{y_{i}}{\sum_{j=1}^{n} y_{j}}=1$$

And when $x_{1}=x_{2}=\cdots=x_{n}=1$,
$$\sum_{i=1}^{n} \frac{1}{a+S-x_{i}}=1$$

Thus, $M=1$.
When $a>1$, let $z_{i}=\frac{y_{i}}{\sum_{i=1}^{n} y_{i}}, i=1,2, \cdots, n$, then $\sum_{i=1}^{n} z_{i}=1$.
$$\frac{y_{i}}{a y_{i}+\sum_{j \neq i}^{n} y_{j}}=\frac{z_{i}}{(a-1) z_{i}+1}=\frac{1}{a-1}\left(1-\frac{1}{(a-1) z_{i}+1}\right) .$$

By the Cauchy-Schwarz inequality,
$$\left(\sum_{i=1}^{n}\left((a-1) z_{i}+1\right)\right)\left(\sum_{i=1}^{n} \frac{1}{(a-1) z_{i}+1}\right) \geqslant n^{2}$$

And
$$\sum_{i=1}^{n}\left((a-1) z_{i}+1\right)=a-1+n$$

Thus,
$$\sum_{i=1}^{n} \frac{1}{(a-1) z_{i}+1} \geqslant \frac{n^{2}}{a-1+n}$$

Combining (12), (13), and (14), we have
$$\begin{aligned}
\sum_{i=1}^{n} \frac{1}{a+S-x_{i}} & \leqslant \frac{1}{a-1} \sum_{i=1}^{n}\left(1-\frac{1}{(a-1) z_{i}+1}\right) \\
& \leqslant \frac{n}{a-1}-\frac{1}{a-1} \cdot \frac{n^{2}}{a-1+n} \\
& =\frac{n}{a-1+n}
\end{aligned}$$

When $x_{1}=x_{2}=\cdots=x_{n}=1$,
$$\sum_{i=1}^{n} \frac{1}{a+S-x_{i}}=\frac{n}{a-1+n}$$

Thus, $M=\frac{n}{a-1+n}$.
When $a<1$, by (12),
$$\sum_{i=1}^{n} \frac{1}{a+S-x_{i}} \leqslant \sum_{i=1}^{n} \frac{y_{i}}{a y_{i}+\sum_{j \neq i}^{n} y_{j}}<\sum_{i=1}^{n} \frac{y_{i}}{a y_{i}+a \sum_{j \neq i}^{n} y_{j}}=\frac{1}{a}$$

When $x_{1}=x_{2}=\cdots=x_{n-1}=\varepsilon \longrightarrow 0^{+}, x_{n}=\varepsilon^{1-n} \longrightarrow+\infty$,
$$\lim _{\varepsilon \rightarrow 0^{+}} \sum_{i=1}^{n} \frac{1}{a+S-x_{i}}=\lim _{\varepsilon \rightarrow 0^{+}}\left(\frac{n-1}{a+\varepsilon^{1-n}}+\frac{1}{a+(n-1) \varepsilon}\right)=\frac{1}{a}$$

Thus, $M=\frac{1}{a}$.
In summary,
$$M=\left\{\begin{array}{ll}
\frac{n}{a-1+n} & \text { if } a \geqslant 1 , \\
\frac{1}{a} & \text { if } 0<a<1
\end{array}\right.$$