Example 5 Let $x_{i} \geqslant 0(i=1,2, \cdots, n)$, and
$$
\sum_{i=1}^{n} x_{i}^{2}+2 \sum_{1 \leqslant k<j \leqslant n} \sqrt{\frac{k}{j}} x_{k} x_{j}=1 \text {. }
$$

Find the maximum and minimum values of $\sum_{i=1}^{n} x_{i}$.
(2001, National High School Mathematics Competition)
Explanation: First, find the minimum value of $\sum_{i=1}^{n} x_{i}$. From $k<j$ we know
$$
\sum_{i=1}^{n} x_{i}^{2}+2 \sum_{1 \leqslant k<j \leqslant n} \sqrt{\frac{k}{j}} x_{k} x_{j} \leqslant\left(\sum_{i=1}^{n} x_{i}\right)^{2} \text {. }
$$

Equality holds if and only if at most one of $x_{1}, x_{2}, \cdots, x_{n}$ is non-zero. Therefore,
$$
\left(\sum_{i=1}^{n} x_{i}\right)^{2} \geqslant 1 \text {. }
$$

Thus, $\left(\sum_{i=1}^{n} x_{i}\right)_{\min }=1$.
Next, find the maximum value of $\sum_{i=1}^{n} x_{i}$.
Let $x_{k}=\sqrt{k} y_{k}$, then we have
$$
\begin{array}{c}
y_{1}^{2}+2 y_{2}^{2}+\cdots+n y_{n}^{2}+2 y_{1}\left(y_{2}+y_{3}+\right. \\
\left.\cdots+y_{n}\right)+2 \times 2 y_{2}\left(y_{3}+y_{4}+\cdots+y_{n}\right)+ \\
\cdots+2(n-1) y_{n-1} y_{n}=1 \\
\Rightarrow\left(y_{1}+y_{2}+\cdots+y_{n}\right)^{2}+\left(y_{2}+y_{3}+\right. \\
\left.\cdots+y_{n}\right)^{2}+\cdots+\left(y_{n-1}+y_{n}\right)^{2}+y_{n}^{2}=1 .
\end{array}
$$

Let $a_{k}=\sum_{i=k}^{n} y_{i}$, then $y_{k}=a_{k}-a_{k+1}$.
From equation (1), we have $\sum_{k=1}^{n} a_{k}^{2}=1$.
Let $a_{n+1}=0$, then $x_{k}=\sqrt{k}\left(a_{k}-a_{k+1}\right)$, hence
$$
\begin{array}{l}
\sum_{k=1}^{n} x_{k}=\sum_{k=1}^{n} \sqrt{k}\left(a_{k}-a_{k+1}\right) \\
=\sum_{k=1}^{n} a_{k}(\sqrt{k}-\sqrt{k-1}) \\
\leqslant \sqrt{\left(\sum_{k=1}^{n} a_{k}^{2}\right)\left[\sum_{k=1}^{n}(\sqrt{k}-\sqrt{k-1})^{2}\right]} \\
=\sqrt{\sum_{k=1}^{n}(\sqrt{k}-\sqrt{k-1})^{2}} .
\end{array}
$$

Equality holds if and only if $\frac{a_{k}^{2}}{(\sqrt{k}-\sqrt{k-1})^{2}}=\frac{1}{\sum_{i=1}^{n}(\sqrt{i}-\sqrt{i-1})^{2}}$ $(k=1,2, \cdots, n)$, i.e.,
$$
\begin{array}{l}
\left(\sum_{k=1}^{n} x_{i}\right)_{\text {max }}=\sqrt{\sum_{k=1}^{n}(\sqrt{k}-\sqrt{k-1})^{2}} \text {. } \\
\end{array}
$$

Note: The key to solving this problem is to make the substitution $x_{k}=\sqrt{k} y_{k}$ and $a_{k}=\sum_{i=k}^{n} y_{i}$, thus obtaining $\sum_{k=1}^{n} x_{k}=\sum_{k=1}^{n} a_{k}(\sqrt{k}-\sqrt{k-1})$.