5. Let the set of $n(2<n<6)$ complex numbers satisfy the following 2 conditions to form a set $S$.
(1) $1 \in S$;
(2) If $x_{1} \in S, x_{2} \in S$, then $x_{1}-2 x_{2} \cos \theta \in S$, where $\theta$ $=\arg \frac{z_{1}}{x_{2}}$.
Then the set $S=$
5. When $x_{1}=z_{2}=z$, from (2) if $z \in S$, then
$$
\begin{array}{l}
z_{1}-2 z_{2} \cos \theta=-z \in S . \\
\because|z|=1 .
\end{array}
$$
$\therefore z \neq-z$, which means $S$ contains an even number of elements.
$$
\because 2<n<6, \therefore n=4 \text {. }
$$
(i) From (1) $1 \in S$. Thus $-1 \in S$;
(ii) Let $z_{1}=\cos \alpha+i \sin \alpha(\sin \alpha \neq 0,0 \leqslant \alpha<2 \pi)$, $z_{3}=1, \theta=\arg \left(\frac{z_{1}}{z_{2}}\right)=\alpha$. From (2) if $z_{1} \in S, 1 \in S$, then $z_{1}-2 \cos \theta=-\cos \alpha+i \sin \alpha \in S$.
$\because \sin \alpha \neq 0=\cos \alpha+i \sin \alpha \neq-(\cos \alpha+i \sin \alpha)$,
$\therefore \cos \alpha-1 \sin \alpha=\cdots \cos \alpha+i \sin \alpha$,

Prove $\cos \alpha=0, \sin \alpha \pm 1$.
$\therefore i \in S, \cdots, \in S$.
$\therefore S=\{1,-1, i,-i\}$.