Example 39 (2001 National High School Competition Question) Let $x_{i} \geqslant 0(i=1,2, \cdots, n)$ and $\sum_{i=1}^{n} x_{i}^{2}+$ $2 \sum_{1 \leq k<j \leq n} \sqrt{\frac{j}{k}} x_{k} x_{j}=1$, find the maximum and minimum values of $\sum_{i=1}^{n} x_{i}$.
Analysis The difficulty in this problem lies in the presence of square roots in the known conditions. To eliminate the square roots, a natural substitution is $x_{k} = \sqrt{k} y_{k}$. Using the identity $\sum_{i=1}^{n} x_{i}^{2} + 2 \sum_{1 \leqslant k < j \leqslant n} x_{k} x_{j} = \left(\sum_{i=1}^{n} x_{i}\right)^{2}$, it is relatively easy to find the minimum value of $\sum_{i=1}^{n} x_{i}$.
Solution Since $1 \leqslant k < j \leqslant n$ implies $x_{k} x_{j} \geqslant \sqrt{\frac{k}{j}} x_{k} x_{j}$, we have
$$
\left(\sum_{i=1}^{n} x_{i}\right)^{2} = \sum_{i=1}^{n} x_{i}^{2} + 2 \sum_{1 \leqslant k < j \leqslant n} x_{k} x_{j} \geqslant \sum_{i=1}^{n} x_{i}^{2} + 2 \sum_{1 \leqslant k < j \leqslant n} \sqrt{\frac{k}{j}} x_{k} x_{j} = 1,
$$

which means $\sum_{i=1}^{n} x_{i} \geqslant 1$. Equality holds if and only if one of $x_{1}, x_{2}, \cdots, x_{n}$ is 1 and the rest are 0, so the minimum value of $\sum_{i=1}^{n} x_{i}$ is 1.

Next, by making the substitution $x_{k} = \sqrt{k} y_{k}$, the given condition becomes $\sum_{k=1}^{n} k y_{k}^{2} + 2 \sum_{1 \leq k < j \leq n} j y_{k} y_{j} = 1$. Through calculations for special cases such as $n=2, n=3$, we can see that the above expression can be rewritten as
$$
\left(y_{1} + y_{2} + \cdots + y_{n}\right)^{2} + \left(y_{2} + y_{3} + \cdots + y_{n}\right)^{2} + \cdots + \left(y_{n-1} + y_{n}\right)^{2} + y_{n}^{2} = 1.
$$

To simplify the expression, we naturally let $a_{1} = \sum_{k=1}^{n} y_{k}, a_{2} = \sum_{k=2}^{n} y_{k}, \cdots, a_{n-1} = y_{n-1} + y_{n}, a_{n} = y_{n}$, i.e., $y_{1} = a_{1} - a_{2}, y_{2} = a_{2} - a_{3}, \cdots, y_{n} = a_{n} - a_{n+1}$ (where $a_{n+1} = 0$), then the problem is transformed into finding the maximum value of $\sum_{i=1}^{n} x_{i} = \sum_{i=1}^{n} \sqrt{i} y_{i} = \sum_{i=1}^{n} \sqrt{i} (a_{i} - a_{i+1})$ under the condition $\sum_{i=1}^{n} a_{i}^{2} = 1$. In fact, by the Cauchy inequality, we have
$$
\begin{aligned}
\sum_{i=1}^{n} x_{i} & = \sum_{i=1}^{n} \sqrt{i} (a_{i} - a_{i+1}) = \sum_{i=1}^{n} \sqrt{i} a_{i} - \sum_{i=1}^{n} \sqrt{i} a_{i+1} = \sum_{i=1}^{n} \sqrt{i a} a_{i} - \sum_{i=1}^{n} \sqrt{i-1} a_{i} \\
& = \sum_{i=1}^{n} (\sqrt{i} - \sqrt{i-1}) a_{i} \leqslant \left[\sum_{i=1}^{n} (\sqrt{i} - \sqrt{i-1})^{\frac{1}{2}} \left(\sum_{i=1}^{n} a_{i}^{2}\right)^{\frac{1}{2}}\right. \\
& = \sqrt{\sum_{i=1}^{n} (\sqrt{i} - \sqrt{i-1})^{2}},
\end{aligned}
$$

Equality holds if and only if
$$
\begin{array}{l}
\frac{a_{1}^{2}}{(\sqrt{1} - \sqrt{0})^{2}} = \frac{a_{2}^{2}}{(\sqrt{2} - \sqrt{1})^{2}} = \cdots = \frac{a_{n}^{2}}{(\sqrt{n} - \sqrt{n-1})^{2}} \\
\Leftrightarrow \frac{a_{k}^{2}}{(\sqrt{k} - \sqrt{k-1})^{2}} = \frac{\sum_{i=1}^{n} a_{i}^{2}}{\sum_{i=1}^{n} (\sqrt{i} - \sqrt{i-1})^{2}} = \frac{1}{\sum_{i=1}^{n} (\sqrt{i} - \sqrt{i-1})^{2}} (k=1,2, \cdots, n) \\
\Leftrightarrow x_{k} = \sqrt{k} y_{k} = \sqrt{k} (a_{k} - a_{k+1}) = \frac{\sqrt{k} (2 \sqrt{k} - \sqrt{k+1} - \sqrt{k-1})}{\sqrt{\sum_{i=1}^{n} (\sqrt{i} - \sqrt{i-1})^{2}}} (k=1,2, \cdots, n).
\end{array}
$$

Therefore, the maximum value of $\sum_{i=1}^{n} x_{i}$ is $\sqrt{\sum_{i=1}^{n} (\sqrt{i} - \sqrt{i-1})^{2}}$.