16. Let $n$ be a given positive integer, $S_{n} \subseteq\left\{\alpha \mid \alpha=\left(p_{1}, p_{2}, \cdots, p_{n}\right), p_{k} \in\{0,1\}, k=1,2, \cdots, n\right\}$. For any elements $\beta=\left(x_{1}, x_{2}, \cdots, x_{n}\right)$ and $\gamma=\left(y_{1}, y_{2}, \cdots, y_{n}\right)$ in the set $S_{n}$, the following conditions are satisfied:
(1) If $\beta=\gamma$, then $\sum_{i=1}^{n} x_{i} y_{i}$ is odd;
(2) If $\beta \neq \gamma$, then $\sum_{i=1}^{n} x_{i} y_{i}$ is even.
(1) When $n=5$, find the maximum number of elements in the set $S_{5}$;
(2) When $n \geqslant 6$, find the maximum number of elements in the set $S_{n}$.
(1) Clearly, each element in $S_{5}$ contains an odd number of 1s.

Since $\left\{\alpha \mid \alpha=\left(p_{1}, p_{2}, \cdots, p_{5}\right), p_{k} \in\{0,1\}, k=1,2, \cdots, 5\right\}$ contains $C_{5}^{1}+C_{5}^{3}+C_{5}^{5} = 16$ elements with an odd number of 1s, we can divide them into the following 5 groups:
Group 1: $(1,0,0,0,0),(1,1,0,0,1),(1,0,1,1,0),(1,1,1,1,1)$;
Group 2: $(0,1,0,0,0),(1,1,1,0,0),(0,1,0,1,1)$;
Group 3: $(0,0,1,0,0),(1,0,1,0,1),(0,1,1,1,0)$;
Group 4: $(0,0,0,1,0),(1,1,0,1,0),(0,0,1,1,1)$;
Group 5: $(0,0,0,0,1),(1,0,0,1,1),(0,1,1,0,1)$.
At most one element from each group can be in $S_{5}$, so $|S_{5}| \leq 5$; constructing $S_{5}=\{(1,0,0,0,0),(0,1,0,0,0),(0,0,1,0,0),(0,0,0,1,0),(0,0,0,0,1)\}$ satisfies the condition. Therefore, the maximum number of elements in the set $S_{5}$ is 5.
(2) On one hand, when $S_{n}=\{(1,0,0, \cdots, 0),(0,1,0, \cdots, 0), \cdots,(0,0,0, \cdots, 1)\}$, it satisfies the condition, and $S_{n}$ contains $n$ elements;
On the other hand, by contradiction. For any elements $\beta=\left(x_{1}, x_{2}, \cdots, x_{n}\right)$ and $\gamma=\left(y_{1}, y_{2}, \cdots, y_{n}\right)$ in $S_{n}$, let $M(\beta, \gamma)=\sum_{i=1}^{n} x_{i} y_{i}$. Assume $S_{n}$ contains $m(m>n)$ elements, denoted as $S_{n}=\left\{\alpha_{1}, \alpha_{2}, \cdots, \alpha_{m}\right\}$. For any integer sequence $\left(u_{1}, u_{2}, \cdots, u_{m}\right)$, where $u_{i} \in\{0,1\}, i=1,2, \cdots, m$.
Consider the vector $u_{1} \alpha_{1}+u_{2} \alpha_{2}+\cdots+u_{m} \alpha_{m} \equiv\left(x_{1}, x_{2}, \cdots, x_{n}\right)(\bmod 2)$, where $x_{i} \in\{0,1\}, i=1,2, \cdots, m$.
Since the left sequence $\left(u_{1}, u_{2}, \cdots, u_{m}\right)$ has $2^{m}$ possibilities, and the right vector $\left(x_{1}, x_{2}, \cdots, x_{n}\right)$ has at most $2^{n}$ possibilities, and $2^{m}>2^{n}$, there must exist different $\left(u_{1}^{\prime}, u_{2}^{\prime}, \cdots, u_{m}^{\prime}\right)$ and $\left(u_{1}^{\prime \prime}, u_{2}^{\prime \prime}, \cdots, u_{m}^{\prime \prime}\right)$ such that $u_{1}^{\prime} \alpha_{1}+u_{2}^{\prime} \alpha_{2}+\cdots+u_{m}^{\prime} \alpha_{m} \equiv u_{1}^{\prime \prime} \alpha_{1}+u_{2}^{\prime \prime} \alpha_{2}+\cdots+u_{m}^{\prime \prime} \alpha_{m}(\bmod 2)$.
Let $v_{i}=u_{i}^{\prime}-u_{i}^{\prime \prime}, i=1,2, \cdots, m$, then $v_{i}$ are not all 0 and $v_{1} \alpha_{1}+v_{2} \alpha_{2}+\cdots+v_{m} \alpha_{m} \equiv(0,0,0, \cdots, 0)(\bmod 2)$.
By the given condition, for any $1 \leqslant i, j \leqslant m, i \neq j$, we have $M\left(\alpha_{i}, \alpha_{i}\right) \equiv 1, M\left(\alpha_{i}, \alpha_{j}\right) \equiv 0(\bmod 2)$,
thus $0 \equiv M\left(\alpha_{i}, v_{1} \alpha_{1}+v_{2} \alpha_{2}+\cdots+v_{m} \alpha_{m}\right)$
$\equiv v_{1} M\left(\alpha_{i}, \alpha_{1}\right)+v_{2} M\left(\alpha_{i}, \alpha_{2}\right)+\cdots+v_{m} M\left(\alpha_{i}, \alpha_{m}\right) \equiv v_{i}(\bmod 2)$,
which contradicts that $v_{i}$ are not all 0. Therefore, the assumption is false.
In conclusion, the maximum number of elements in the set $S_{n}$ is $n$.