Assume $ a_n\in O(n^{-k} )$ and $ a_n\geq 0$. Simply bounding the cosine term by 1 we get that
$$ |\sum_{n> m} a_n \cos(2\pi x n)|< C m^{-k+1} $$ (for $ k> 1$).
However, this doesn't exploit oscillation. For example, for $ x =1/2$ we can easily improve the bound to $ C m^{-k} $ by first bounding the sum of each two consecutive terms.
For irrational $ x $, the cosine terms are symmetrically distributed around $0$, so I could imagine that we can get the same bound as for $ x=1/2$, but I cannot prove it.
For rational $ x $, I don't really have a good idea of what is going on.
Question: What are optimal bounds on the residual for rational or irrational $ x $ and how are they proved?
(A small probably irrelevant note: considering the sum as a sum of functions on $ x\in [0,1) $ and using orthogonality of the wave functions, one can show that the mean square (over $ x$) residual is $ m^{-k+1/2} $.)