Playing with sines I wanted to find $$ S(x)=\sum_{k=0}^\infty\sin(kx) $$
Writing it as $$ S(x)=\mathrm{Im}\big(A(x)\big),\quad\text{where}\quad A(x)=\sum_{k=0}^\infty e^{ikx} $$ and using $z=e^{ix}=\cos(x)+i\sin(x)$, cheating about $\|z\|=1$ in order to write $$ A(x)=\frac{1}{1-z}, $$
I found that
$$ 2S(x)=\frac{\sin(x)}{1-\cos(x)} $$
as WolframAlpha does.
My question is: why with the same method I found $$ \sum_{k=0}^\infty\cos(kx)=\frac{1}{2} $$ while WolframAlpha and G.H.Hardy on the book "Divergent Series" (pg. 2) give $-1/2$?
Since, in general, we dont have $\lim_{k\to\infty}\sin(kx)=0$, the series $\sum_{k=0}^\infty\sin(kx)$ diverges (in other words, the sum $\sum_{k=0}^\infty\sin(kx)$ does not exist), and so does the series $\sum_{k=0}^\infty\cos(kx)$.