How can we find the limit of $\sum_{k=1}^n \cos kx$ as $n\to\infty$ in the distributional sense?
I have no idea but the following direct computation:
$$\langle \sum_{k=1}^n \cos kx,\phi \rangle =\int_{\Bbb R}\sum_{k=1}^n \cos kx \ \phi(x) \ dx =\sum_{k=1}^n \int_{\Bbb R} \cos kx \ \phi(x) \ dx \\ =\sum_{k=1}^n \int_{\Bbb R} \cos y\frac{1}{k} \ \phi(\frac{y}{k}) \ dy =\int_{\Bbb R} \sum_{\nu=1}^m \frac{1}{k} \ \phi(\frac{y}{k})\cos y \ dy $$
for any test function $\phi$.
Then what is the limit?
Hint: The Dirac comb distribution of period $T$ is given by $$ \text{III}_T(t) = \sum_{k=-\infty}^{+\infty} \delta(t-kT) = \frac{1}{T}\sum_{k=-\infty}^{+\infty} e^{2\pi i k t/T} $$