Let $p > 3$ be a prime number, and $\zeta$ be a primitive $p$-th root of unity. I am interested in knowing the exact value of $$w_p = \prod_{a \in (\mathbb F_p^{\times})^2}(1 + \zeta^a) + \prod_{b \in \mathbb F_p^{\times} \backslash (\mathbb F_p^{\times})^2}(1 + \zeta^b). $$ (The term $w_p$ is related to the number of subsets $S \subset \mathbb F_p$ for which $\sum_{s \in S} s^2 = 0.$)

It is more or less straightforward to prove that $w_p = 2$ for $p \equiv \pm 1 \ (\text{mod}. 8)$ and $w_p = -2$ for $p \equiv 3 \ (\text{mod}. 8).$

(If anyone wants to see a proof for that, I can provide it. It boils down to the fact that $2 \in (\mathbb F_p^{\times})^2$ in the first case and $-1 \not\in (\mathbb F_p^{\times})^2$ in the scond case.)

So it remains to evealuate $w_p$ for $p \equiv 5 \ (\text{mod}. 8)$. One might conjecture that in this case, we also have $w_p = -2$, but this is wrong: The values for $p = 5,13,29,37$ are $w_p = 3,11,27,146$.

Indeed, it is easy to show that also in this case $w_p$ is an integer and $w_p \equiv -2 \ (\text{mod}. p)$. Looking at the values for small $p$, I arrived at the following conjecture:

Suppose $p \equiv 5 \ (\text{mod}. 8)$. Let $(\alpha,\beta)$ be the fundamental positive solution of the generalized Pell equation $\alpha^2 - p \beta^2 = 4$. Then $w_p = \alpha$.

Can anyone tell me if this statement is true?