Why does this limit make the sum converge? I was messing around with sums on Wolfram Alpha and I came across a weird result that I do not understand. I initially typed in $\sum_{n=1}^\infty\sin(nx)$ to which the response was that it does not converge (which was expected), however, underneath was a result involving a 'Dirichlet Regularization' that stated $\lim_{s \rightarrow 0}\sum_{n=1}^\infty n^{-s}\sin(nx) = \frac{1}{2}\cot \frac{x}{2}$.
I've tried to do some research but I have yet to find anything that helps me understand why this limit actually makes this sum converge. Any explaination or direction on where I can learn more about this would be greatly appreciated!
Edit: A proof for this sum as well would be greatly appreciated
 A: Define the Polylogarithm functions
$$\newcommand{\Li}{\operatorname{Li}}
\Li_s(x)=\sum_{k=1}^\infty\frac{x^k}{k^s}\tag1
$$
For $s\gt0$, Summation by Parts and the Mean Value Theorem say
$$
\begin{align}
(1-x)\Li_s(x)
&=\sum_{k=1}^\infty\frac{x^k-x^{k+1}}{k^s}\tag{2a}\\
&=x+\sum_{k=2}^\infty x^k\!\left(\frac1{k^s}-\frac1{(k-1)^s}\right)\tag{2b}\\
&=x-s\sum_{k=2}^\infty\frac{x^k}{(k-\theta_{k,s})^{s+1}}\tag{2c}
\end{align}
$$
Explanation:
$\text{(2a)}$: multiply $(1)$ by $1-x$
$\text{(2b)}$: Summation by Parts
$\text{(2c)}$: Mean Value Theorem where $0\lt\theta_{k,s}\lt1$
Thus, $\frac1{(k-\theta_{k,s})^{s+1}}$ is decreasing from something less than $1$ to $0$, and, as usual, we have the bound $\left|\,\sum\limits_{k=1}^ne^{ikx}\,\right|\le\frac1{|\sin(x/2)\,|}$. Dirichlet's Test then says that
$$
\left(1-e^{ix}\right)\Li_s\left(e^{ix}\right)=e^{ix}+O\!\left(\frac s{|\sin(x/2)\,|}\right)\tag3
$$
This means that for $e^{ix}\ne1$,
$$
\begin{align}
\lim_{s\to0^+}\Li_s\left(e^{ix}\right)
&=\frac{e^{ix}}{1-e^{ix}}\tag{4a}\\
&=-\frac{e^{ix/2}}{e^{ix/2}-e^{-ix/2}}\tag{4b}\\
&=-\frac{\cos(x/2)+i\sin(x/2)}{2i\sin(x/2)}\tag{4c}\\
&=-\frac12+\frac i2\cot(x/2)\tag{4d}
\end{align}
$$
Explanation:
$\text{(4a)}$: take the limit of $(3)$
$\text{(4b)}$: multiply numerator and denominator by $-e^{-ix/2}$
$\text{(4c)}$: write things in terms of $\sin$ and $\cos$
$\text{(4d)}$: simplify
Taking the imaginary parts of $\text{(4d)}$, we get
$$
\bbox[5px,border:2px solid #C0A000]{\lim_{s\to0^+}\sum_{k=1}^\infty\frac{\sin(kx)}{k^s}=\frac12\cot(x/2)}\tag5
$$
The original sum, for $s=0$, still does not converge, but taking the limit of this regularization gives a value.
