Example 41 (1994 National Training Team Question) Let $S=\{1,2,3, \cdots, 10\}, A_{1}, A_{2}, \cdots, A_{k}$ be subsets of $S$, satisfying the conditions:
(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$.
To construct a $10 \times k$ number table, where the number at the $i$-th row and $j$-th column is
$$
x_{i j}=\left\{\begin{array}{l}
1\left(\text { if } i \in A_{j}\right) \\
0\left(\text { if } i \notin A_{j}\right)
\end{array}(i=1,2, \cdots, 10, j=1,2, \cdots, k),\right.
$$

the sum of elements in the $i$-th row $r_{i}=\sum_{j=1}^{k} x_{i j}$ represents the number of sets among $A_{1}, A_{2}, \cdots, A_{k}$ that $i$ belongs to, and the sum of elements in the $j$-th column $\left|A_{j}\right|=\sum_{i=1}^{10} x_{i j}$ represents the number of elements in the set $A_{j}$. From the given condition (1), we have
$$
\begin{aligned}
\left|A_{j}\right| & =\sum_{j=1}^{10} x_{i j}=5, \\
\text { thus } \sum_{i=1}^{10} r_{i} & =\sum_{i=1}^{10} \sum_{j=1}^{k} x_{i j}=\sum_{j=1}^{k} \sum_{i=1}^{10} x_{i j}=\sum_{j=1}^{k}\left|A_{j}\right|=5 k .
\end{aligned}
$$

If $t$ belongs to two sets $A_{i}, A_{j}(i \neq j)$, then $\left\{t, A_{i}, A_{j}\right\}$ forms a triplet. Let the number of such triplets be $S$.

On one hand, since $t$ belongs to $r_{t}$ sets, it can form $C_{r_{t}}^{2}$ triplets containing $t$, so $S=\sum_{t=1}^{10} C_{r_{t}}^{2}$. On the other hand, for any $A_{i}, A_{j}(i \neq j)$, they have $\left|A_{i} \cap A_{j}\right|$ common elements, which can form $\left|A_{i} \cap A_{j}\right|$ triplets containing $A_{i}, A_{j}$, so $S=\sum_{1 \leqslant i<j \leqslant k}\left|A_{i} \cap A_{j}\right| \leqslant 2 C_{k}^{2}=k(k-1)$. Therefore, by the Cauchy-Schwarz inequality and (1), we get
$$
\begin{aligned}
k(k-1) & =\sum_{t=1}^{10} C_{r_{t}}^{2}=\frac{1}{2}\left(\sum_{t=1}^{10} r_{t}^{2}-\sum_{t=1}^{10} t_{r}\right) \\
& \geqslant \frac{1}{2}\left[\frac{1}{10}\left(\sum_{t=1}^{10} r_{t}\right)^{2}-\sum_{t=1}^{10} r_{t}\right]=\frac{1}{2}\left[\frac{1}{10}(5 k)^{2}-5 k\right] \\
& =\frac{5}{4} k(k-2),
\end{aligned}
$$

Solving the inequality gives $k \leqslant 6$.
Furthermore, the following 6 sets satisfy conditions (1) and (2):
$$
\begin{array}{l}
A_{1}=\{1,2,3,4,5\}, A_{2}=\{1,2,6,7,8\}, A_{3}=\{1,3,6,9,10\}, \\
A_{4}=\{2,4,7,9,10\}, A_{5}=\{3,5,7,8,10\}, A_{6}=\{4,5,6,8,9\} .
\end{array}
$$

Therefore, the maximum value of $k$ is 6.