Example 4 Given that $S$ is a subset of the set $\{1,2, \cdots, n\}$, $S$ contains no number that divides another, and no two numbers are coprime. Find the maximum value of $|S|$.

 untranslated text remains unchanged.
【Analysis】First, from the construction, guess the maximum value $k$. To construct a set without divisibility relations, we can choose $\{m, m+1, \cdots, n\}\left(m>\frac{n}{2}\right)$. To construct a set of numbers that are pairwise not coprime, we can choose $\left\{2,4, \cdots, 2\left[\frac{n}{2}\right]\right\}([x]$ represents the largest integer not exceeding the real number $x)$. Taking the intersection of the two sets, denoted as $S_{n}$, ensures that any two numbers in $S_{n}$ have neither a divisibility relation nor a coprime relation. According to $n(\bmod 4)$, the number of elements in $S_{n}$ is:
$$
\begin{array}{l}
\left|S_{4 k}\right|=k,\left|S_{4 k+1}\right|=k, \\
\left|S_{4 k+2}\right|=k+1,\left|S_{4 k+3}\right|=k+1 .
\end{array}
$$

Use the pigeonhole principle to prove that the above $\left|S_{n}\right|$ is the maximum value of $|S|$. The number of target pigeonholes should be $\left|S_{n}\right|$. As long as the numbers in each pigeonhole have a divisibility relation or are coprime, it ensures that $|S|$ does not exceed the number of pigeonholes.

First, set the pigeonholes as $\{4 t+1,4 t+2,4 t+3, 4 t+4\}\left(t=0, \cdots,\left[\frac{4}{n}\right]-1\right)$. It is found that $4 t+1$, $4 t+2$, and $4 t+3$ are pairwise coprime, and $4 t+2$ and $4 t+4$ are not coprime, and generally do not have a divisibility relation. Thus, make an adjustment: take each $2^{u}(2 t+1)(u \geqslant 2)$ out and place it in the pigeonhole containing $4 t+2$.

The number of pigeonholes remains unchanged, but the size of the pigeonholes will differ. Each pigeonhole contains numbers of the form
$$
\left\{4 t+1,4 t+3,(2 t+1) \times 2^{u}\right\}
$$

Clearly, the numbers in each pigeonhole are pairwise coprime or have a divisibility relation, which meets the conditions of the problem.
The number of pigeonholes constructed in this way, for
$$
n=4 k, 4 k+1,4 k+2,4 k+3
$$

cases, respectively, yields $k$, $k+1$, $k+1$, and $k+1$ pigeonholes. Except for $n=4 k+1$, the number of pigeonholes is the same as the previously constructed $\left|S_{n}\right|$. Therefore, for $n=4 k+1$, the number of pigeonholes needs to be reduced by 1.
At this point, the last pigeonhole contains only the number $4 k+1$.
If 3 divides $(4 k+1)$, place $4 k+1$ in the pigeonhole $\left\{1,3,2^{2}\right\}$;

If 3 does not divide $(4 k+1)$, place $4 k+1$ in the pigeonhole $\{4 k-1, 4 k-2, 4 k-3\}$.

It can be verified that the new pigeonholes still satisfy the condition that any two numbers in them have a divisibility relation or are coprime, which meets the conditions of the problem.
Therefore, $|S|=\left|S_{n}\right|=\left[\frac{n+2}{4}\right]$.
The pigeonholes used in the following example have some overlapping parts. The pigeonhole principle with overlapping pigeonholes can be considered as follows: Let $A_{1}, A_{2}, \cdots, A_{n}$ be some subsets of set $A$, and their union is $A$. Let $D$ be a subset of $A$ such that its elements belong to two $A_{i}$. If “+” represents the union operation of sets that counts the multiplicity of elements, it can be written as
$$
A_{1}+A_{2}+\cdots+A_{n}=A+D \text {. }
$$

Let $B(B \subset A)$ be a subset. Then
$$
\sum_{i=1}^{n}\left|B \cap A_{i}\right|=|B \cap A|+|B \cap D| \text {. }
$$

By the pigeonhole principle, it can be inferred that at least one $\left|B \cap A_{i}\right| \geqslant \frac{|B|}{n}$.
Example 5 uses the reverse relationship
$$
|B| \geqslant \sum_{i=1}^{n}\left|B \cap A_{i}\right|-|D| .
$$