Example 1 Let $S$ be a subset of the set $\{1,2,3, \cdots, 50\}$, and the sum of any two elements in $S$ cannot be divisible by 7. What is the maximum number of elements in $S$?
Analysis We pay attention to "7", and construct drawers.
Solution We divide these 50 numbers into 7 sets according to their remainders when divided by 7:
$$
\begin{array}{l}
A_{0}=\{7,14,21,28,35,42,49\} \\
A_{1}=\{1,8,15,22,29,36,43,50\} \\
A_{2}=\{2,9,16,23,30,37,44\} \\
A_{3}=\{3,10,17,24,31,38,45\} \\
A_{4}=\{4,11,18,25,32,39,46\} \\
A_{5}=\{5,12,19,26,33,40,47\} \\
A_{6}=\{6,13,20,27,34,41,48\}
\end{array}
$$

Apart from the 7 elements in $A_{0}$, the elements in the other six sets cannot be divided by 7, and the sum of any two elements in each of these six sets cannot be divided by 7. However, if we take one element from each of the pairs $A_{1}$ and $A_{6}$, $A_{2}$ and $A_{5}$, $A_{3}$ and $A_{4}$, the sum of these two elements can be divided by 7. Therefore, the elements of the required set can be constructed as follows: take one element from $A_{0}$, and then take all elements from one of the two sets in each of the pairs $A_{1}$ and $A_{6}$, $A_{2}$ and $A_{5}$, $A_{3}$ and $A_{4}$. To maximize the number of elements, we must take 8 elements from $A_{1}$, and then 7 elements from $A_{2}$ and $A_{3}$. Therefore, the set $S$ can have at most $1+8+7+7=23$ elements.
Comment Note the application of the drawer principle in sets.