5. For a set, the difference between the maximum and minimum elements is called the "capacity" of the set. Let $2 \leqslant r \leqslant n$, and let $F(n, r)$ denote the arithmetic mean of the capacities of all $r$-element subsets of the set $M=\{1,2, \cdots, n\}$. Then $F(n, r)=$
5. $\frac{(r-1)(n+1)}{r+1}$.

The number of $r$-element subsets of set $M$ is $\mathrm{C}_{n}^{r}$. Among these, the number of $r$-element subsets with the smallest element $i$ and the largest element $j (1 \leqslant i < j \leqslant n)$ is $\mathrm{C}_{j-i-1}^{r-2}$. Therefore,
$$
\begin{array}{l}
F(n, r)=\frac{1}{\mathrm{C}_{n}^{r}}\left[\sum_{1 \leqslant i < j \leqslant n}(j-i) \mathrm{C}_{j-i-1}^{r-2}\right] \\
=\frac{1}{\mathrm{C}_{n}^{r}}\left[\sum_{1 \leqslant i < j \leqslant n}(r-1) \mathrm{C}_{j-i}^{r-1}\right] \\
=\frac{r-1}{\mathrm{C}_{n}^{r}}\left(\sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \mathrm{C}_{j-i}^{r-1}\right)=\frac{r-1}{\mathrm{C}_{n}^{r}}\left(\sum_{i=1}^{n-1} \sum_{k=1}^{n-1} \mathrm{C}_{k}^{r-1}\right) \\
=\frac{r-1}{\mathrm{C}_{n}^{r}}\left(\sum_{i=1}^{n-1} \mathrm{C}_{n-i+1}^{r}\right)=\frac{r-1}{\mathrm{C}_{n}^{r}} \sum_{i=2}^{n} \mathrm{C}_{i}^{r} \\
=\frac{r-1}{\mathrm{C}_{n}^{r}} \mathrm{C}_{n+1}^{r+1}=\frac{(r-1)(n+1)}{r+1} .
\end{array}
$$