How can I find the value of this [pathological] function?
For rational multiples of $\pi$, $\text{sgn}(\cos(nx))$ is periodic and the sum can be done in "closed form" in terms of the Digamma function. Thus for $x = 3\pi/4$, Maple tells me:
sum(sum(signum(cos(k*3*Pi/4))/(k+8*m),k=1..8),m=0..infinity);
$$ \frac{\pi}{4} - \frac{\ln(2)}{4} + \frac{\Psi(1/8) - \Psi(3/8)}{4} $$
This is more like an extended comment. From the Fourier series
$$ \operatorname{sign}(\cos(x)) = \frac{\pi}{4}\sum_{k=0}^{\infty} \frac{(-1)^k}{2k+1} \cos((2k+1)x), $$
we heuristically compute that
\begin{align*} f(x) &= \frac{4}{\pi}\sum_{n=1}^{\infty}\sum_{k=0}^{\infty} \frac{(-1)^k}{n(2k+1)}\cos(n(2k+1)x) \\ &= \frac{1}{\pi} \sum_{l=1}^{\infty} \frac{r_2(l)}{l} \cos(lx) \\ &= \frac{1}{\pi} \sum_{\mathrm{k} \in \mathbb{Z}^2 \setminus\{0\}} \frac{\cos(|\mathrm{k}|x)}{|\mathrm{k}|}, \end{align*}
where $r_2(\cdot)$ is the sum of squares functions and the second step follows by rearranging the sum according to the value of $l = n(2k+1)$, although establishing the validity of such manipulation would be a non-trivial task.
The following is the plot of of the partial sum $\frac{1}{\pi} \sum_{l=1}^{1000} \frac{r_2(l)}{l} \cos(lx)$ evaluated at points of the form $x = \frac{k \pi}{1025}$ for $|k| \leq 1025$, replicating OP's figure.