Finding $\lim_{n\to\infty}\frac1{n^3}\sum_{k=1}^{n-1}\frac{\sin\frac{(2k-1)\pi}{2n}}{\cos^2\frac{(k-1)\pi}{2n}\cos^2\frac{k\pi}{2n}}$ 
For all $n\ge 1$, let
$$
a_{n}=\sum_{k=1}^{n-1} \frac{\sin \left(\frac{(2 k-1) \pi}{2 n}\right)}{\cos ^{2}\left(\frac{(k-1) \pi}{2 n}\right) \cos ^{2}\left(\frac{k \pi}{2 n}\right)}
$$
Find $\displaystyle\lim_{n\to\infty}\frac{a_n}{n^3}$.

This is a problem from the 2019 Putnam competition.
The official solutions use two different strategies; one reduces the expression as a telescoping sum and the other uses the asymptotic property of sine near zero. The two community-wiki answers below essentially elaborate on the official solutions.
Remark. I am curious if one can write $\displaystyle\frac{a_n}{n^3}$ as a Riemann sum so that one can write the limit as an integral. Naively, the fraction looks very much like $\frac{1}{n}\sum_{k=1}^{n-1}\cdots$, which is in the setting of Riemann sums. (This only serves as a comment, not a requirement for solving the problem.)

This solution is based on one of the official solutions for the problem.
The dummy variable $k$ is a dummy variable in $a_n$. Since
\begin{align}
\sum_{k=1}^{n-1}f(k;n) &= f(1;n)+f(2;n)+\cdots+f(n-1;n)\\
&= f(n-1;n) + f(n-2;n) +\cdots f(n-(n-1);n)\\
&= \sum_{k=1}^{n-1}f(n-k;n)
\end{align}
we can substitute $n-k$ for $k$ to obtain
$$
a_{n}=\sum_{k=1}^{n-1} \frac{\sin \left(\frac{(2 k+1) \pi}{2 n}\right)}{\sin ^{2}\left(\frac{(k+1) \pi}{2 n}\right) \sin ^{2}\left(\frac{k \pi}{2 n}\right)}
$$
We then use the estimate
$$
\frac{\sin x}{x} = 1+O(x^2)\quad \text{as }  x\to 0
$$
to rewrite the summand as
$$
\frac{\left(\frac{(2 k-1) \pi}{2 n}\right)}{\left(\frac{(k+1) \pi}{2 n}\right)^{2}\left(\frac{k \pi}{2 n}\right)^{2}}\left(1+O\left(\frac{k^{2}}{n^{2}}\right)\right)
$$
which simplifies to
$$
\frac{8(2 k-1) n^{3}}{k^{2}(k+1)^{2} \pi^{3}}+O\left(\frac{n}{k}\right)
$$
Consequently,
$$
\begin{aligned} \frac{a_{n}}{n^{3}} &=\sum_{k=1}^{n-1}\left(\frac{8(2 k-1)}{k^{2}(k+1)^{2} \pi^{3}}+O\left(\frac{1}{k n^{2}}\right)\right) \\ 
&=\left[\frac{8}{\pi^{3}} \sum_{k=1}^{n-1} \frac{(2 k-1)}{k^{2}(k+1)^{2}}\right]
+O\left(\frac{\log n}{n^{2}}\right) \end{aligned}
$$
Finally, note that
$$
\sum_{k=1}^{n-1} \frac{(2 k-1)}{k^{2}(k+1)^{2}}=\sum_{k=1}^{n-1}\left(\frac{1}{k^{2}}-\frac{1}{(k+1)^{2}}\right)=1-\frac{1}{n^{2}}\;.
$$
It is now easy to finish the calculation.
