Example 4 Let the natural number $n \geqslant 5, n$ different natural numbers $a_{1}, a_{2}, \cdots, a_{n}$ have the following property: for any two different non-empty subsets $A$ and $B$ of the set $S=$ $\left\{a_{1}, a_{2}, \cdots, a_{n}\right\}$, the sum of all numbers in $A$ and the sum of all numbers in $B$ will not be equal. Under the above conditions, find the maximum value of $\frac{1}{a_{1}}+\frac{1}{a_{2}}+\cdots+\frac{1}{a_{n}}$. (1994 Shanghai Competition Problem)
Let's assume $a_{1}c_{2}>\cdots>c_{n}$,
$$
D_{k}=\sum_{i=1}^{k} a_{i}-\left(1+2+\cdots+2^{k-1}\right)=\sum_{i=1}^{k} a_{i}-\left(2^{k}-1\right) \geqslant 0 .
$$

Thus, we have
$$
\begin{array}{l}
1+\frac{1}{2}+\cdots+\frac{1}{2^{n-1}}-\left(\frac{1}{a_{1}}+\frac{1}{a_{2}}+\cdots+\frac{1}{a_{n}}\right)=\sum_{i=1}^{k} c_{i} d_{i} \\
=c_{1} D_{1}+c_{2}\left(D_{2}-D_{1}\right)+\cdots+c_{n}\left(D_{n}-D_{n-1}\right) \\
=\left(c_{1}-c_{2}\right) D_{1}+\left(c_{2}-c_{3}\right) D_{2}+\cdots+\left(c_{n-1}-c_{n}\right) D_{n-1}+c_{n} D_{n} \\
\geqslant 0 .
\end{array}
$$

Therefore, inequality (2) is proved.
Notice that when $S=\left\{1,2,2^{2}, \cdots, 2^{n-1}\right\}$, the given condition holds. In this case, we have
$$
\frac{1}{a_{1}}+\frac{1}{a_{2}}+\cdots+\frac{1}{a_{n}}=1+\frac{1}{2}+\cdots+\frac{1}{2^{n-1}}=2-\frac{1}{2^{n-1}} .
$$

Thus, the maximum value sought is $2-\frac{1}{2^{n-1}}$.