Let $p$ and $K$ be integers $ \ge 2$. For any $r \in \{0,1,\ldots,p-1\}$, define
$$ s(r) := \frac{1}{K}\sum_{k=0}^{K-1} \cos(\frac{2\pi kr}{p}). $$ Alternatively, note that $s(r) = \mathbb E\, \cos(2\pi k r /p)$ for $k$ uniformly random in $\{0,1,\ldots,K-1\}$.
Now, it is clear that $s(0) = 1$. Define $s_* := \max_{r \ne 0}|s(r)|$. I've empirically noticed that $s_*$ is very small as soon as $K \ge p$, but I don't know how to quantify this precisely.
Question. What is the asymptotic growth rate of $s_*$ as a function of $K$ and $p$ ?
Edit
Thanks to a comment of user @rtybase, we know that
$$ s(r) = \frac{1}{n} + \frac{\sin((n-1)\theta(r)}{n\sin(\theta(r))}, $$ where $n=2K$ and $\theta(r) := \pi r/p$ for all $r \in \{1,2,\ldots,p-1\}$. It is then clear that $s(r)$ is largest when $r=1$. Thus, $$ s_* = \frac{1}{n} + \frac{\sin((n-1)\pi/p)}{n\sin(\pi/p)} \simeq \frac{\sin((n-1)\pi/p)}{n\sin(\pi/p)}. $$ So we, are left with the problem of upper bounding $$ r(p,n) := \frac{\sin((n-1)\pi/p)}{n\sin(\pi/p)} $$ as a function of $n$ and $p$.