It can be shown that if $q \equiv 2 \mod 4 $ and $(p,q) = 1$ then
$$ \sum_{n=0}^{q-1} e^{2\pi i \frac{p}{q} n^2} = 0 $$
By the theory of Quadratic Gauss Sums which is intimately tied to Quadratic Reciprocity.
I am interested in proving the related observation: where again if $(p,q) = 1$ and $q \equiv 2 \mod 4$ then
$$ \frac{1}{q} \sum_{n=0}^{q-1} (q - n) e^{2\pi i \frac{p}{q} n^2} = \frac{1}{2} $$
I have been able to verify this for the first $50$ such natural numbers $q$.
The following simplifications can be observed:
$$ \frac{1}{q} \sum_{n=0}^{q-1} (q - n) e^{2\pi i \frac{p}{q} n^2} = \sum_{n=0}^{q-1} e^{2\pi i \frac{p}{q} n^2} - \frac{1}{q} \sum_{n=0}^{q-1} n e^{2\pi i \frac{p}{q} n^2} = 0 - \frac{1}{q} \sum_{n=0}^{q-1} n e^{2\pi i \frac{p}{q} n^2} $$
So the theorem we really want to show is that if $q \equiv 2 \mod 4$ and $(p,q) =1$ then:
$$ \sum_{n=0}^{q-1} n e^{2\pi i \frac{p}{q} n^2}= -\frac{q}{2} $$
Motivation:
This sum is motivated by looking at certain divergent series such as
$$ 1 - 1 + 1 - 1 + 1 .... = \frac{1}{2} \ (\mathcal{C}) $$
Where the $(\mathcal{C})$ indicates an assignment and not a literal equality. Whenever a divergent series $\sum a_n $ has the property that $a_n$ has a finite period $p$ and $\sum_{k = 0}^{p-1} a_k = 0 $ then Cesaro Summation assigns the following divergent sum: $$\sum_{k=0}^{\infty} a_k = \frac{1}{p} \sum_{k=0}^{p-1} (p-k)a_k $$
So, in effect I am also asking why the Cesaro Summation of square powers of the "$q \equiv 2 \mod 4$"th roots of unity is always equal to $\frac{1}{2}$. There are some deep reasons involving the theta functions why this ought to be true per this answer of Jorge Zuniga but this looks like it could tractable using the same set of techniques that prove the original Quadratic Gauss Sum Results.
$\sum_{n=0}^{q-1}{ne^{2\pi i \frac{p}{q}n^2}}=\sum_{n=1}^{q-1}{ne^{2\pi i \frac{p}{q}n^2}}=\sum_{n=1}^{q/2-1}{ne^{2\pi i \frac{p}{q}n^2}}+\sum_{n=q/2+1}^{q-1}{ne^{2\pi i \frac{p}{q}n^2}}+\frac{q}{2}e^{\pi i \frac{pq}{2}}$.
Since $\frac{q}{2}$ is odd, the last term is equal to $-\frac{q}{2}$. Also,
$\sum_{n=0}^{q-1}{ne^{2\pi i \frac{p}{q}n^2}}=-\frac{q}{2}+\sum_{n=1}^{q/2-1}{\left(ne^{2\pi i \frac{p}{q}n^2} +(q-n)e^{2\pi i \frac{p}{q}(n-q)^2}\right)}$.
To simplify the last exponential term:
$e^{2\pi i \frac{p}{q}(n-q)^2}=e^{2\pi i \frac{p}{q}n^2}\times e^{2\pi i pq} \times e^{-4\pi i np}=e^{2\pi i \frac{p}{q}n^2}$.
Substituting:
$\sum_{n=0}^{q-1}{ne^{2\pi i \frac{p}{q}n^2}}=-\frac{q}{2}+q\sum_{n=1}^{q/2-1}{e^{2\pi i \frac{p}{q}n^2} }=-\frac{q}{2}+\frac{q}{2}\left(\sum_{n=1}^{q/2-1}{e^{2\pi i \frac{p}{q}n^2} } + \sum_{n=q/2+1}^{q-1}{e^{2\pi i \frac{p}{q}n^2} } \right) $
$= -\frac{q}{2}+\frac{q}{2}\left(\sum_{n=1}^{q-1}{e^{2\pi i \frac{p}{q}n^2} } - e^{\pi i \frac{pq}{2}} \right) = -\frac{q}{2}+\frac{q}{2}\left(\sum_{n=1}^{q-1}{e^{2\pi i \frac{p}{q}n^2} } +1 \right) = -\frac{q}{2}+\frac{q}{2}\left(\sum_{n=0}^{q-1}{e^{2\pi i \frac{p}{q}n^2} } \right) = -\frac{q}{2}$