Lemma: $$\sum_{n=1}^{m} \sin(a + nd) = \frac{\sin\left(\frac{md}2\right)\sin\left(\frac{2a + md + d}2\right)}{\sin\left(\frac{d}2\right)}$$ $$\sum_{n=1}^{m} \cos(a + nd) = \frac{\sin\left(\frac{md}2\right)\cos\left(\frac{2a + md + d}2\right)}{\sin\left(\frac{d}2\right)}$$
Proof: Consider the LHS of both equations scaled by a multiplication of $\sin\left(\frac{d}2\right)$. Upon using the identities for $\sin(a)\sin(b)$ and $\sin(a)\cos(b)$ for the first and second qualities respectively one finds that the sums telescope and yield the lemma.
To your problem, defining $A_k = \frac{2k-1}{2m}\pi$, one has
$$\begin{align}m^2S&:= \sum_{k=1}^m \sum_{l=1}^m \sin(rA_k)\sin(rA_l) \cos(rA_k - rA_l) \\ m^2S &= \sum_{k=1}^m \sum_{l=1}^m \sin(rA_k)\sin(rA_l)\left(\cos(rA_k)\cos(rA_l) + \sin(rA_k)\sin(rA_l)\right) \tag{1.1}\\ m^2S &= \sum_{k=1}^m \sin(rA_k)\cos(rA_k)\sum_{l=1}^m \sin(rA_l)\cos(rA_l) + \sum_{k=1}^m \sin^2(rA_k) \sum_{l=1}^m \sin^2(rA_l) \tag{1.2}\\ m^2S &= \left(\sum_{k=1}^m \sin(rA_k)\cos(rA_k)\right)^2 + \left(\sum_{k=1}^m \sin^2(rA_k)\right)^2 \tag{1.3} \\ m^2S &= \frac14\left(\sum_{k=1}^m 2\sin(rA_k)\cos(rA_k)\right)^2 + \frac14\left(\sum_{k=1}^m 2\sin^2(rA_k)\right)^2 \iff \\
4m^2S &= \left(\sum_{k=1}^m \sin(2rA_k)\right)^2 + \left(\sum_{k=1}^m 1-\cos(2rA_k)\right)^2 \tag{1.4} \\
4m^2S &= \left(\sum_{k=1}^m \sin\left(\frac{r}{m}(2k-1)\pi\right)\right)^2 + \left(m - \sum_{k=1}^m \cos\left(\frac{r}{m}(2k-1)\pi\right)\right)^2 \tag{1.5}\\
4m^2S &= \left(\sum_{k=1}^m \sin\left(\frac{2r\pi}{m}k - \frac{r\pi}{m}\right)\right)^2 + \left(m - \sum_{k=1}^m \cos\left(\frac{2r\pi}{m}k - \frac{r\pi}{m}\right)\right)^2 \\
4m^2S &= \csc^2\left(\frac{r\pi}{m}\right)\cdot \sin^4\left(r\pi\right) + \left(m - \sin(r\pi)\cos(r\pi)\csc\left(\frac{r\pi}{m}\right)\right)^2 \tag{1.6} \ \ \ \ \ \ \ (\not\exists p\in\mathbb Z : r=mp)\\
S &= \frac{m^2 + \csc^2\left(\frac{r\pi}{m}\right)\sin^2(r\pi) - m\sin(2r\pi)\csc\left(\frac{r\pi}{m}\right)}{4m^2} \tag{1.7}
\end{align}$$
But if $\exists p \in \mathbb Z: r=mp$ then at $(1.5)$ the lemma can not be applied; instead $$\begin{align} 4m^2S &= \left(\sum_{k=1}^m \color{green}{\sin(p(2k-1)\pi)}\right)^2 + \left(m - \sum_{k=1}^m \color{pink}{\cos(p(2k-1)\pi)}\right)^2 \\ 4m^2S &= \left(\sum_{k=1}^m \color{green}{0}\right)^2 + \left(m - \sum_{k=1}^m \color{pink}{\pm 1}\right)^2 \tag{1.8}\\ 4m^2S &= \begin{cases}0 & p\text{ is even} \\ 4m^2 & p\text{ is odd}\end{cases}\end{align}$$
Thus, we can combine all three results into one "short" form:
$$\boxed{S = \begin{cases}0 & \frac{r}{m} \text{ is even} \\ \\ 1 &\frac{r}{m}\text{ is odd} \\ \\ \frac{m^2 + \csc^2\left(\frac{r\pi}{m}\right)\sin^2(r\pi) - m\sin(2r\pi)\csc\left(\frac{r\pi}{m}\right)}{4m^2} & \frac{r}{m} \notin \mathbb Z\end{cases}}$$
This is the most general closed-form of this summation. When $0<r<m$ with $r, m \in \mathbb Z$ we have that the last case applies from the closed form of $S$ and since $\sin(r\pi) = 0$, all but one of the terms vanish and we are left with $S= \frac14$. When $r=m$ we have that the second case applies of the closed form of $S$ and we get $S=1$.
Explanations:
$(1.1)$ follows from the compound $\cos$ identity.
$(1.2)$ and $(1.3)$ follow from distributivity of addition over multiplication.
$(1.4)$ follows via the identity $2\sin(a)\cos(a) = \sin(2a)$ and $\sin^2(a) = 1-\cos(2a)$.
$(1.6)$ follows from applying aforesaid lemma. The restraint comes from that $\csc$ must be defined for this formula to hold. The other case is also handled.
$(1.7)$ using $(a+b)^2 = a^2 + b^2 + 2ab$, regrouping, and using $\sin^2(r\pi) = \sin^4(r\pi) + \sin^2(r\pi)\cos^2(r\pi)$.
$(1.8)$ for any integer $n$, $\sin(nx) = 0$; if $n$ is odd then $\cos(nx) = -1$ and if $n$ is even then $\cos(nx) = 1$.