Let $p$ be a prime number and $\big(\frac{a}{p} \big)$ the Legendre symbol.
Then we have the equality
$$\sum_{a=1}^{p-1} \big(\frac{a}{p} \big) \zeta^a =\sum_{t=0}^{p-1} \zeta^{t^2},$$ where $\zeta$ is a primitive $p$th root of unity.
This follows by the interpretation that $\big(\frac{a}{p} \big)$ is $1$ if $a$ is a square mod $p$ and $-1$ otherwise.
I am wondering if the similar equality holds when $p$ is not a prime number but an integer $n$. I know that the Jacobi symbol is a generalization of the Legendre symbol. But the interpretation as above doesn't hold in general.
So my questions are:
Does the following equality hold $$\sum_{a=1}^{n-1} \big(\frac{a}{n} \big) \zeta^a =\sum_{t=0}^{n-1} \zeta^{t^2},$$ where $\zeta$ is a primitive $n$ the root of unity and $\big(\frac{a}{n} \big)$ is the Jacobi symbol? (It seems that this does not hold for a general $n$. Is there any specific condition that this equality holds?)
If so, what is the condition on $n$ and how do I prove it?
If not, is there a similar function (character) $f$ satisfying the following equality $$\sum_{a=1}^{n-1} f(a) \zeta^a =\sum_{t=0}^{n-1} \zeta^{t^2} ?$$