How find this sum $S(x)=\sum_{k=1}^{\infty}\frac{\cos{(2kx\pi)}}{k}$ Find this sum
$$S(x)=\sum_{k=1}^{\infty}\dfrac{\cos{(2kx\pi)}}{k},x\in R$$
my idea: since
$$S'(x)=2x\pi\cdot\sum_{k=1}^{\infty}\sin{(2kx\pi)}$$
then I can't.
 A: $S(x)$ is real part of $\displaystyle\sum_{k=1}^{\infty}\frac{e^{2x\pi i}}k$
But,$\displaystyle\sum_{k=1}^{\infty}\frac{e^{2kx\pi i}}k=-\ln(1-e^{2x\pi i})$
Now $\displaystyle1-e^{2x\pi i}=-e^{x\pi i}(e^{x\pi i}-e^{-x\pi i})=-e^{x\pi i}(2i\sin x\pi)$
For $\displaystyle \sin x\pi>0, \ln(1-e^{2x\pi i})=\ln(2\sin x\pi)+x\pi i+\ln(-i)$
Again, $\displaystyle -i=e^{-\dfrac{i\pi}2}\implies \ln(-i)=\left(2n\pi-\dfrac{i\pi}2\right)i$ for some integer $n$
But we are interested in the real part only
Similarly, if $\displaystyle \sin x\pi<0$
If $\displaystyle \sin x\pi=0,\cos2kx\pi=\cdots=1,$ then $S(x)=?$
A: $\newcommand{\+}{^{\dagger}}
 \newcommand{\angles}[1]{\left\langle\, #1 \,\right\rangle}
 \newcommand{\braces}[1]{\left\lbrace\, #1 \,\right\rbrace}
 \newcommand{\bracks}[1]{\left\lbrack\, #1 \,\right\rbrack}
 \newcommand{\ceil}[1]{\,\left\lceil\, #1 \,\right\rceil\,}
 \newcommand{\dd}{{\rm d}}
 \newcommand{\down}{\downarrow}
 \newcommand{\ds}[1]{\displaystyle{#1}}
 \newcommand{\expo}[1]{\,{\rm e}^{#1}\,}
 \newcommand{\fermi}{\,{\rm f}}
 \newcommand{\floor}[1]{\,\left\lfloor #1 \right\rfloor\,}
 \newcommand{\half}{{1 \over 2}}
 \newcommand{\ic}{{\rm i}}
 \newcommand{\iff}{\Longleftrightarrow}
 \newcommand{\imp}{\Longrightarrow}
 \newcommand{\isdiv}{\,\left.\right\vert\,}
 \newcommand{\ket}[1]{\left\vert #1\right\rangle}
 \newcommand{\ol}[1]{\overline{#1}}
 \newcommand{\pars}[1]{\left(\, #1 \,\right)}
 \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}}
 \newcommand{\pp}{{\cal P}}
 \newcommand{\root}[2][]{\,\sqrt[#1]{\vphantom{\large A}\,#2\,}\,}
 \newcommand{\sech}{\,{\rm sech}}
 \newcommand{\sgn}{\,{\rm sgn}}
 \newcommand{\totald}[3][]{\frac{{\rm d}^{#1} #2}{{\rm d} #3^{#1}}}
 \newcommand{\ul}[1]{\underline{#1}}
 \newcommand{\verts}[1]{\left\vert\, #1 \,\right\vert}
 \newcommand{\wt}[1]{\widetilde{#1}}$
$\ds{{\rm S}\pars{x}\equiv\sum_{k = 1}^{\infty}{\cos\pars{2kx\pi} \over k}:\
    {\large ?}.\qquad\qquad x\in {\mathbb R}}$

\begin{align}
&\color{#66f}{\large{\rm S}\pars{x}}
=\Re\sum_{k = 1}^{\infty}\expo{2kx\pi\,\ic}
\int_{0}^{1}t^{k - 1}\,\dd t
=\Re\int_{0}^{1}\sum_{k = 1}^{\infty}\pars{\expo{2x\pi\,\ic}t}^{k}\,{\dd t \over t}
=\Re\int_{0}^{1}{\expo{2x\pi\,\ic}t \over 1 - \expo{2x\pi\,\ic}t}\,{\dd t \over t}
\\[3mm]&=-\left.\Re\ln\pars{1 - \expo{2x\pi\,\ic}t}
\right\vert_{\,t\ =\ 0}^{\,t\ =\ 1}
=-\Re\ln\pars{1 - \expo{2x\pi\,\ic}}
=-\Re\ln\pars{\expo{x\pi\,\ic}\bracks{\expo{-x\pi\,\ic} - \expo{x\pi\,\ic}}}
\\[3mm]&=-\Re\ln\pars{-2\ic\expo{x\pi\,\ic}\sin\pars{\pi x}}
=-\Re\ln\pars{2\bracks{\sin\pars{\pi x} - \ic\cos\pars{\pi x}}\sin\pars{\pi x}}
\\[3mm]&=\color{#66f}{\large-\ln\pars{\root{2}\verts{\sin\pars{\pi x}}}}
\end{align}

