Example 3 Let $S=\{1,2, \cdots, 10\}, A_{1}, A_{2}, \cdots, A_{k}$ be subsets of $S$ and satisfy (1) $\left|A_{i}\right|=5, i=1,2, \cdots, k$; (2) $\left|A_{i} \cap A_{j}\right| \leqslant 2,1 \leqslant i<j \leqslant k$. Find the maximum value of $k$.
Solution: Let $k$ be the number of subsets satisfying conditions (1) and (2), and let $i$ belong to $x_{i}$ of these $k$ subsets, where $i=1,2, \cdots, 10$. If $i \in A_{j}, i \in A_{k}, j \neq k$, then $i$ is called a repeated pair. Thus, the number of repeated pairs caused by the number $i$ is $\mathrm{C}_{x_{i}}^{2}$. The total number of repeated pairs caused by the 10 elements in $S$ is $\mathrm{C}_{x_{1}}^{2}+\mathrm{C}_{x_{2}}^{2}+\cdots+\mathrm{C}_{x_{10}}^{2}, x_{1}+x_{2}+\cdots+x_{10}=5 k$.

On the other hand, there are at most two repeated pairs between any two subsets, so there are at most $2 \mathrm{C}_{k}^{2}$ repeated pairs among the $k$ subsets. Therefore, we have
$$
\mathrm{C}_{x_{1}}^{2}+\mathrm{C}_{x_{2}}^{2}+\cdots+\mathrm{C}_{x_{n}}^{2} \leqslant 2 \mathrm{C}_{k}^{2}
$$

By the Cauchy-Schwarz inequality, we have
$$
\begin{array}{l}
\mathrm{C}_{x_{1}}^{2}+\mathrm{C}_{x_{2}}^{2}+\cdots+\mathrm{C}_{x_{n}}^{2} \\
=\frac{1}{2}\left\{x_{1}\left(x_{1}-1\right)+x_{2}\left(x_{2}-1\right)+\cdots+x_{10}\right. \\
\left.\left(x_{10}-1\right)\right\} \\
=\frac{1}{2}\left(x_{1}^{2}+x_{2}^{2}+\cdots+x_{10}^{2}\right)-\frac{1}{2}\left(x_{1}+x_{2}+\cdots\right. \\
\left.+x_{10}\right) \\
=\frac{1}{2}\left(x_{2}^{1}+x_{2}^{2}+\cdots+x_{10}^{2}\right)-\frac{5}{2} k \\
\geqslant \frac{1}{20}(5 k)^{2}-\frac{5}{2} k=\frac{5}{4} k(k-2) \\
\end{array}
$$

From (1) and (2), we get
$$
\frac{5}{4}(k-2) \leqslant k-1
$$

Solving (3) yields $k \leqslant 6$. This indicates that there are at most 6 subsets.