Inspired by a problem of calculating explicitly the invariants by Reshetikhin and Turaev for certain 3-manifolds, I have come across the following problem involving Gauss sums:
I would like to prove that $\sum_{n=0}^k e^{-\tfrac{2\pi i}{4k+8}(n^2+2n)} = e^{\pi i/(2k+4)}\left(\sqrt{\tfrac{k}{2}+1}e^{-\pi i/4} - \frac{-e^{-\pi ik/2}+1}{2} \right).$
Edits: By a number of simplifications (see the comments below), this becomes $\sum_{n=1}^{r-1} e^{\tfrac{\pi i}{2r}n^2} = \sqrt{r}\frac{1+i}{2} - \frac{e^{\pi i r/2} + 1}{2}.$
This on the other hand is equivalent to $\sum_{n=1}^{r-1} e^{\tfrac{\pi i}{2r}n^2} = \sum_{n=1}^{r-1} e^{\tfrac{\pi i}{2r}(n+r)^2}$ for all $r$, and this can be checked by noting that the two sums contain the same terms.
The rest of this question is left over from my original wording: When $k$ (or $r$) is even, this formula holds by the following quadratic reciprocity theorem (and a couple of tricks):
Let $a,b,c$ be integers, $a \not= 0$, $c \not= 0$, and assume that $ac+b$ is even. Then
$\sum_{n=0}^{\lvert c \rvert -1} e^{\pi i(an^2+bn)/c} = \lvert c/a \rvert^{1/2} e^{\pi i (\lvert ac \rvert-b^2)/(4ac)} \sum_{n=0}^{\lvert a\rvert-1} e^{-\pi i (c n^2+b n)/a}.$
However, when my $k$ is odd, this can not be applied directly. Any suggestions are welcome.