Example 2 Let $0 \leqslant x_{i} \leqslant 1(1 \leqslant i \leqslant n)$, find the maximum value of $F=\sum_{1 \leqslant i<j \leq n}\left|x_{i}-x_{j}\right|$.
Since $F$ is continuous on a closed domain, there must exist a maximum value. Fixing $x_{2}, x_{3}, \cdots, x_{n}$, then $F\left(x_{1}\right)$ is a function of $x_{1}$:
$$F\left(x_{1}\right)=\left|x_{1}-x_{2}\right|+\left|x_{1}-x_{3}\right|+\cdots+\left|x_{1}-x_{n}\right|+\sum_{2 \leqslant i<j \leqslant n}\left|x_{i}-x_{j}\right| .$$

Thus, $F\left(x_{1}\right)$ attains its maximum value if and only if $\left|x_{1}-x_{2}\right|+\left|x_{1}-x_{3}\right|+\cdots+\left|x_{1}-x_{n}\right|$ attains its maximum value. Since $0 \leqslant x_{i} \leqslant 1$, by the lemma mentioned above, when $F\left(x_{1}\right)$ attains its maximum value, it must be that $x_{1} \in\{0, 1\}$. By symmetry, when $F$ attains its maximum value, it must be that $x_{i} \in\{0,1\}(1 \leqslant i \leqslant n)$.

Therefore, we can assume that when $F$ attains its maximum value, $x_{i}$ has $k$ zeros and $n-k$ ones. Then,
$$\begin{aligned}
F & \leqslant(0-0) \times \mathrm{C}_{k}^{2}+(1-1) \times \mathrm{C}_{n-k}^{2}+\mathrm{C}_{k}^{1} \mathrm{C}_{n-k}^{1} \\
& =k(n-k) \leqslant\left[\frac{k+(n-k)}{2}\right]^{2}=\frac{n^{2}}{4}
\end{aligned}$$

Since $F$ is an integer, we have $F \leqslant\left[\frac{n^{2}}{4}\right]$.
Equality holds when $x_{1}=x_{2}=\cdots=x\left[\frac{n}{2}\right]=0, x\left[\frac{n}{2}\right]+1=\cdots=x_{n}=1$. Therefore, the maximum value of $F$ is $\left[\frac{n^{2}}{4}\right]$.