Let $n \geqslant 2$ be a positive integer, and let $x_{1}, x_{2}, \cdots, x_{n}$ be non-negative real numbers satisfying $\sum_{i=1}^{n} x_{i}^{2}=1, M=\max \left\{x_{1}, x_{2}, \cdots, x_{n}\right\}$. Try to find the maximum and minimum values of
$$
S=n M^{2}+2 \sum_{1 \leqslant i<j \leqslant n} x_{i} x_{j}
$$
Let $M=x_{1}$, then
$$
S=n x_{1}^{2}+\left(\sum_{i=1}^{n} x_{i}\right)^{2}-\sum_{i=1}^{n} x_{i}^{2}=n x_{1}^{2}+\left(\sum_{i=1}^{n} x_{i}\right)^{2}-1 .
$$

By the Cauchy-Schwarz inequality, we have
$$
\begin{aligned}
\left(\sum_{i=1}^{n} x_{i}\right)^{2} & \leqslant(1+\underbrace{\frac{1}{\sqrt{n}+1}+\cdots+\frac{1}{\sqrt{n}+1}}_{n-1 \uparrow})\left(x_{1}^{2}+(\sqrt{n}+1) x_{2}^{2}+\cdots+(\sqrt{n}+1) x_{n}^{2}\right) \\
& =\sqrt{n} x_{1}^{2}+(n+\sqrt{n}) x_{2}^{2}+\cdots+(n+\sqrt{n}) x_{n}^{2},
\end{aligned}
$$

Therefore,
$$
S \leqslant(n+\sqrt{n}) x_{1}^{2}+(n+\sqrt{n}) x_{2}^{2}+\cdots+(n+\sqrt{n}) x_{n}^{2}-1=n+\sqrt{n}-1 .
$$

The equality holds when $x_{2}=\cdots=x_{n}$ and $x_{1}=(\sqrt{n}+1) x_{2}$, which satisfies the requirement that $x_{1}$ is the largest. Hence, the maximum value of $S$ is $n+\sqrt{n}-1$.
Let
$$
t=\left\{\begin{array}{ll}
{[\sqrt{n}],} & \text { if }\{\sqrt{n}\}\frac{1}{2}
\end{array}\right.
$$

Then, when $x_{1}=x_{2}=\cdots=x_{t}=\frac{1}{\sqrt{t}}, x_{t+1}=\cdots=x_{n}=0$, we have $S=\frac{n}{t}+t-1$. We will now prove that this is the minimum value of $S$.
It suffices to prove
$$
n x_{1}^{2}+\left(\sum_{i=1}^{n} x_{i}\right)^{2}-\left(\frac{n}{t}+t\right) \sum_{i=1}^{n} x_{i}^{2} \geqslant 0 .
$$

Considering the left-hand side as a quadratic function of $x_{2}$, since the coefficient of the quadratic term is less than 0, the function reaches its minimum value when $x_{2}=x_{1}$ or 0. Similarly, the left-hand side reaches its minimum value when $x_{3}, \cdots, x_{n}$ are all equal to $x_{1}$ or 0. Suppose $x_{2}, \cdots, x_{n}$ have $s-1$ values equal to $x_{1}$ and the remaining $n-s$ values equal to 0, then
$$
n x_{1}^{2}+\left(\sum_{i=1}^{n} x_{i}\right)^{2}-\left(\frac{n}{t}+t\right) \sum_{i=1}^{n} x_{i}^{2}=n x_{1}^{2}+s^{2} x_{1}^{2}-\left(\frac{n}{t}+t\right) s x_{1}^{2}=s x_{1}^{2}\left(\frac{n}{s}+s-\left(\frac{n}{t}+t\right)\right) \text {. }
$$

Since $\frac{n}{s}+s$ achieves its minimum value at $\frac{n}{t}+t$, inequality (1) holds.