Let $\omega = e^{\frac{2\pi i}{d}}$, where $d$ is prime. Also let $0 < a < d$ and $0 < b < d$ (note that $a$ and $b$ are non-zero). Is there a nice formula for:
$S = \sum\limits_{j=0}^{d-1} \omega^{aj + bj(j-1)/2}$
Ideally, I'd like to find $\phi$ such that $S = r e^{i \phi}$. I already know that $r = \sqrt{d}$, but I don't know how to express $\phi$ as a function of $a$, $b$ and $d$.