The Series
This series only converges for $x\in\mathbb{R}$. If $x\not\in\mathbb{R}$, the terms do not go to $0$.$\newcommand{\sgn}{\operatorname{sgn}}\newcommand{\Re}{\operatorname{Re}}\newcommand{\Im}{\operatorname{Im}}$
$$
\begin{align}
&\sum_{r=1}^\infty(-1)^{r+1}\frac{\cos((2r-1)x)}{2r-1}\tag{1a}\\
&=\frac12\sum_{r=1}^\infty(-1)^{r+1}\frac{e^{i(2r-1)x}}{2r-1}+\frac12\sum_{r=1}^\infty(-1)^{r+1}\frac{e^{-i(2r-1)x}}{2r-1}\tag{1b}\\
&=\frac12\tan^{-1}\left(e^{ix}\right)+\frac12\tan^{-1}\left(e^{-ix}\right)\tag{1c}\\[9pt]
&=\Re\left(\tan^{-1}\left(e^{ix}\right)\right)\tag{1d}\\[12pt]
&=\frac\pi4\,\sgn(\cos(x))\tag{1e}
\end{align}
$$
Explanation:
$\text{(1b)}$: $\cos(x)=\frac12\left(e^{ix}+e^{-ix}\right)$
$\text{(1c)}$: power series for $\tan^{-1}(z)$
$\text{(1d)}$: $\tan(\bar z)=\overline{\tan(z)}$
$\text{(1e)}$: $|\tan(z)\,|=1$ when $\Re(z)=\pm\frac\pi4$
$\phantom{\text{(1e):}}$ and $\Re(\tan(z))$ has the same sign as $\Re(z)$
$\phantom{\text{(1e):}}$ also, if $\cos(x)=0$, all the terms of the series are $0$
Concerning $\boldsymbol{\tan(x+iy)}$
Note that
$$
\begin{align}
\tan(x+iy)&=\frac{\sin(x)\cosh(y)+i\cos(x)\sinh(y)}{\cos(x)\cosh(y)-i\sin(x)\sinh(y)}\tag{2a}\\
&=\frac{\sin(x)\cos(x)+i\sinh(y)\cosh(y)}{\cos^2(x)\cosh^2(y)+\sin^2(x)\sinh^2(y)}\tag{2b}
\end{align}
$$
is on the unit circle when the absolute values of the numerator and denominator are equal. Since $\cosh^2(y)-\sinh^2(y)=1$, equation $\text{(2a)}$ says that is when
$$
\begin{align}
\sin^2(x)\cosh^2(y)+\cos^2(x)\sinh^2(y)&=\cos^2(x)\cosh^2(y)+\sin^2(x)\sinh^2(y)\tag{3a}\\[6pt]
\sin^2(x)&=\cos^2(x)\tag{3b}
\end{align}
$$
Thus, $|\tan(z)\,|=1$ when $\Re(z)=\pm\frac\pi4$
Furthermore, equation $\text{(2b)}$ says not only that $\tan(\bar z)=\overline{\tan(z)}$, but also that, when $\Re(z)=\pm\frac\pi4$, $\Re(\tan(z))$ has the same sign as $\Re(z)$.
