This is just an observation, but doesn't fit neatly into a comment.
$n$ must be even, otherwise it is impossible to have the sum of $r_i$ be zero.
Let $\sigma$ be a permutation so that $|a_{\sigma_1}|\geq ... \geq |a_{\sigma_n}|$. Then we have $| \sum_{i=1}^n a_i r_i | \leq |a_{\sigma_1}|+...+|a_{\sigma_{\frac{n}{2}}}|-(|a_{\sigma_{\frac{n}{2}+1}}| +...+ |a_{\sigma_n}|)$ and the bounds are achieved with appropriate (legal) choice of $r_i$. I have no idea how this translates into bounds on $\cos(\sum_{i=1}^n a_i r_i)$ without more information about the $a_i$.