I am wondering if there is a closed form to the following finite sum:
$$\sum_{k=1}^{p-1} \frac{1-\cos\left(\frac{2\pi k r}{p}\right)}{1-\cos\left(\frac{2\pi k s}{p}\right)},$$
where $\gcd(p,rs)=1$ and $r,s,p$ are positive integers, and if so how would I go about figuring out the closed form?
EDIT: I arrived at this sum as I am investigating the value of the $T_2$-norm of units in the cyclotomic ring $\mathbb{Z}(\zeta_{p})$ for prime $p$. The $T_2$-norm of an element $x \in K$ for some number field $K$ of degree $n$ is defined:
$$ ||x|| = \left(\sum_{i=1}^n |\sigma_i(x)|^2\right)^{1/2}, $$
where $\{\sigma_1, \dots, \sigma_n\}$ are the embeddings of $K$ and $|x|^2 = x\bar{x}$ where the bar represents complex conjugation.
Lemma: For $\gcd{(rs,p)}=1$, $\frac{\zeta^r -1}{\zeta^s -1}$ is a unit of $\mathbb{Z}(\zeta_p)$.
Proof: Let $r \equiv st \mod p$. Then $\frac{\zeta^r-1}{\zeta^s-1} = 1 + \zeta^s + \dots + \zeta^{s(t-1)} \in \mathbb{Z}(\zeta_p)$, and its inverse is also in $\mathbb{Z}(\zeta_p)$ by the same logic.
So for unit $u$ of the aforementioned form, we have:
$$ |u|^2 = \frac{\zeta^r-1}{\zeta^s-1} \frac{\zeta^{-r}-1}{\zeta^{-s}-1} = \frac{2-(\zeta^r + \zeta^{-r})}{2-(\zeta^{s} + \zeta^{-s})} = \frac{1-\cos(\frac{2\pi r}{p})}{1-\cos(\frac{2\pi s}{p})}. $$
Since $\sigma_k(\zeta_p) = \zeta_p^k$, we have:
$$ ||u||^2 = \sum_{k=1}^{p-1} \frac{1-\cos(\frac{2\pi k r}{p})}{1-\cos(\frac{2\pi k s}{p})}. $$
I believe to find a closed form for the sum:
$$\forall r,s,p:\quad\gcd(r s, p)=1:\quad \sum_{k=1}^{p-1} \frac{1-\cos\frac{2\pi k r}{p}}{1-\cos\frac{2\pi k s}{p}}=q(p-q),\tag{1}$$ with $$ q=r s^{\phi(p)-1}\text{ mod }p\tag{2}, $$ where $\phi(p)$ is Euler's totient function.
The proof of the expression (1) outlined by Jack D'Aurizio can be completed in the following way:
Observing that (1) is a linear combination of Fejér kernels, $F_q(x)$, rewrite it as: $$ \sum_{k=1}^{p-1} \left(\frac{\sin\frac{\pi k q}{p}}{\sin\frac{\pi k}{p}} \right)^2 =\sum_{k=1}^{p-1} qF_q\left(\frac{2\pi k}{p}\right) =\sum_{k=1}^{p-1}\sum_{|l|\leq q}\left(q-|l|\right)e^{\frac{lk}{p}2\pi i} =\sum_{|l|\leq q}\left(q-|l|\right)\Phi(l,p), $$ with $$ \Phi(l,p)=\sum_{k=1}^{p-1}e^{\frac{lk}{p}2\pi i}= p\delta_{l0}-1.\tag{3} $$ The proof of (3) for $l\ne 0$ follows from the observation that $$ \sum_{k=0}^{p-1}e^{\frac{lk}{p}2\pi i}=0, $$ as the sum runs over all roots of the polynomial $z^\frac{p}{\gcd(l,p)}-1$ (each of the roots entering the sum $\gcd(l,p)$ times).
Thus $$ \sum_{|l|\leq q}\left(q-|l|\right)\Phi(l,p)=q(p-1)-2\sum_{l=1}^{q-1}l =q(p-1)-q(q-1)=q(p-q), $$ as claimed.