Can you give a closed form or an asymptotic for $\sum_{m=0}^{k-1}\cos(\frac{2\pi m n}{k \log 2})$ for $k\to\infty$? I want compute, in a closed form or an asymptotic (with a, big oh as, error term) this mean 
$$\delta_k(n):=\sum_{m=0}^{k-1}\cos(\frac{2\pi m n}{k \log 2})$$
defined for each integer $k\geq 1$. Truly I am interesting in $\sum_{1\leq k\leq n}\delta_k(n)$ in this exercise, but if your computations are good, it should be satisfactory. 
I've made some humble computations (the good analysis that solve this exercise is required for you) using Euler-MacLaurin summation with $P_1(x)=x-\lfloor x\rfloor-\frac{1}{2}$, looking to compute 
$$\delta_{k}(n)=1+\sum_{m=1}^{k-1}cos(\frac{2\pi m n}{k \log 2}).$$
Now,
$$\sum_{m=1}^{k-1}\cos(\frac{2\pi m n}{k \log 2})=\int_{1}^{k-1}\cos(\frac{2\pi x n}{k \log 2})dx-\frac{2\pi n}{k\log 2}\int_1^{k-1}P_1(x)\sin(\frac{2\pi x n}{k \log 2})dx$$
$$\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad+\frac{1}{2}(\cos(\frac{2\pi  n}{k \log 2})+\cos(\frac{2\pi (k-1) n}{k \log 2})).$$
And $$\int_{1}^{k-1}\cos(\frac{2\pi x n}{k \log 2})dx=\frac{k\log 2}{2\pi n}\left(\sin(\frac{2\pi (k-1) n}{k \log 2})-\sin(\frac{2\pi n}{k \log 2})\right).$$
Too, I know that $x-\lfloor x\rfloor=O(1)$, and by MacLaurin series expansion for the sine function that $\sin (\frac{2\pi x n}{k \log 2})=\frac{2\pi x n}{k \log 2}+O((\frac{2\pi x n}{k \log 2})^3)$.
Then, (if my computations are rigth) 

Question. Can you give a closed form or an asymptotic for $\delta_k(n)$, as $k\to\infty$? Thanks in advance.

You can ask to me about more context, but is only a curiosity build as my previous post.
 A: Let $x=2\pi n/\log(2)$ and let $f_k(x)$ be the sequence given by
$$f_k(x)=\sum_{m=0}^{k-1}\cos (m\,x/k) \tag 1$$
Then, we can write the sum in $(1)$ as  
$$\begin{align}
\sum_{m=0}^{k-1}\cos (m\,x/k) &=\text{Re}\left(\sum_{m=0}^{k-1}e^{i m\,x/k} \right)\\\\
&=\text{Re}\left(\frac{1-e^{ix}}{1-e^{ix/k}}\right)\\\\
&=\sin^2(x/2)+\frac12 \sin(x)\,\cot(x/2k)
\end{align}$$
Next, we expand the cotangent function and write
$$f_k(x)=\frac{2\sin(x)\,k}{x}+\sin^2(x/2)-\frac{x\sin(x)}{6k}-\frac{x^3\sin(x)}{360k^3}+O\left(\frac{1}{k^5}\right)$$
Therefore, for $\delta_k(n)$ we have
$$\begin{align}
\delta_k(n)&=\left(\frac{\log (2)\sin\left(\frac{2\pi n}{\log(2)}\right)}{n\pi}\right)k\\\\
&+(1+\sin^2\left(n\pi/\log(2)\right))\\\\
&-\left(\frac{n\pi\,\sin\left(\frac{2\pi n}{\log(2)}\right)}{3\log(2)}\right)\frac1k\\\\
&+\left(\frac{(n\pi)^3\sin\left(\frac{2\pi n}{\log(2)}\right)}{45\log^3(2)}\right)\frac{1}{k^3}\\\\
&+O\left(\frac{1}{k^5}\right)
\end{align}$$
A: There is a known formula 
$$\sum_{m=0}^{k-1} \cos (m x)=\cos \frac{(k-1)x}{2} \sin \frac{k x}{2} \csc \frac{x}{2}.$$
In this put $$x=\frac{2\pi n}{k \log 2}$$
and it will match your $\delta_k(n).$
