Example 2 Let $S$ be a set with 6 elements. In how many ways can two (not necessarily distinct) subsets of $S$ be chosen so that the union of the two subsets is $S$? The order of selection does not matter. For example, the pair of subsets $\{a, c\}, \{b, c, d, e, f\}$ and the pair of subsets $\{b, c, d, e, f\}, \{a, c\}$ represent the same selection.
(11th American Invitational Mathematics Examination)
Solution: Let $S=A \cup B$, and without loss of generality, assume $|A| \leqslant|B|$ (denote the number of elements in set $S$ as $|S|$).

If $|A|=0$, then $A=\varnothing, B=S$, there is only 1 way to choose;

If $|A|=1$, then $|B|=6,5$. At this time, there are $\mathrm{C}_{6}^{1} \mathrm{C}_{6}^{6} +\mathrm{C}_{6}^{1} \mathrm{C}_{5}^{5}=12$ ways to choose;

If $|A|=2$, then $|B|=6,5,4$. At this time, there are $\mathrm{C}_{6}^{2} \mathrm{C}_{6}^{6}+\mathrm{C}_{6}^{2} \mathrm{C}_{2}^{1} \mathrm{C}_{4}^{4}+\mathrm{C}_{6}^{2} \mathrm{C}_{4}^{1}=60$ ways to choose;

If $|A|=3$, then $|B|=6,5,4,3$. At this time, there are $\mathrm{C}_{6}^{3} \mathrm{C}_{6}^{6}+\mathrm{C}_{6}^{3} \mathrm{C}_{6}^{2}+\mathrm{C}_{6}^{3} \mathrm{C}_{3}^{1}+\frac{1}{2} \mathrm{C}_{6}^{3} \mathrm{C}_{3}^{3}=150$ ways to choose; $\square$

If $|A| \vdots=4$, then $|B|=6,5,4$. At this time, there are $\mathrm{C}_{6}^{4} \mathrm{C}_{6}^{6}+\mathrm{C}_{5}^{4} \mathrm{C}_{4}^{3}+\frac{\mathrm{i}}{2} \mathrm{C}_{6}^{4} \mathrm{C}_{4}^{2}=120$ ways to choose;

If $|A|=5$, then $|B|=6,5$. At this time, there are $\mathrm{C}_{6}^{5} \mathrm{C}_{6}^{6} +\frac{1}{2} \mathrm{C}_{6}^{5} \mathrm{C}_{5}^{4}=21$ ways to choose.

If $|A|=6$, then $|B|=6$. At this time, there is only one way to choose.
In summary, the number of ways to choose that satisfy the problem is
$$
1+12+60+150+120+21+1=365 \text { (ways). }
$$