Given a natural number $n>0$ and a complex number $z = x + i y$ of unit modulus, $x^2 + y^2 = 1$, the equality
$$\left(z + \frac{1}{z}\right)^n = 2^{n-1}\left(z^n + \frac{1}{z^n}\right)$$
may or may not hold. For a fixed $n$, we denote by $S(n)$ the subset of unit-modulus complex numbers for which the given equality holds. You are asked:
a) Compute $S(n)$, with justification, for $n=2,3,4,5$.
b) Give an upper bound for the number of elements of $S(n)$ as a function of $n$, for $n>5$.