Convergence of $\sum\frac{\tan(nz)}{n^2}$ to an analytic function...what if $z\in \mathbb{R}$? 
For which values of $z$ does $$\sum_{n=1}^\infty
 \frac{\tan(nz)}{n^2}$$ converge? For which values of $z$ is the
  limiting function analytic?

One can show, as in this answer, that $$\left|\frac{e^{inz}-e^{-inz}}{e^{inz}+e^{-inz}}\right|$$ is bounded as $n\to \infty$, so long as $\text{Im}(z)\neq 0$. But the article above really does not discuss the case $\text{Im}(z)=0$, although it thinks it does. It doesn't deal with the poles at $\frac{(2k+1)\pi}{2}$, which can make some of the terms of the series undefined. 
If $\text{Im}(z)=0$, obviously the estimate $$\left| 
\frac{e^{inz}-e^{-inz}}{e^{inz}+e^{-inz}} \right|\leq \frac{1+e^{2ny}}{|1-e^{2ny}|} $$
does not work. (Here $y=\text{Im}(z)$.) For $x\in \mathbb{R}$ of the form $j^2\frac{(2k+1)\pi}{2}$, there will be undefined terms. 
Suppose there are no undefined terms. What can we say then about convergence? And in what way can we describe these singularities of the limiting function, corresponding to $x$ with undefined terms? Perhaps these points are not even isolated...
 A: Following sos440's answer given here, we can show that this series diverges whenever the irrationality measure of $z/\pi$ is greater than $3$.
Let $\mu$  denote the irrationality measure of $\frac{z}{\pi}$. Then, for any $\eta<\mu$, there exists infinitely many $p,q$ such that $$\left|\frac{1}{\pi z}-\frac{2p+1}{2q}\right|\leq\frac{1}{q^{\eta}},$$ and so $$\left|qz-\frac{\pi}{2}-p\pi\right|\leq\frac{\pi}{q^{\eta-1}}.$$ Consequently, $$|\tan(qz)|=|\tan\left(\frac{\pi}{2}+\left(qz-\frac{\pi}{2}-p\pi\right)\right)\gg\frac{1}{\left|qz-\frac{\pi}{2}-p\pi\right|}\gg q^{\eta-1}.$$ Thus there exists a constant $C$ such that for infinitely many $q$ $$\frac{\tan(qz)}{q^{2}}\geq Cq^{\eta-3}.$$ If $\mu>3$ so that $\eta$ can be taken to equal $3$, then there are infinitely many terms in the series bounded away from $0$, which implies that it diverges.
This implies that if $z=\ell/\pi$ where $\ell$ is Liouville's number, then the series diverges.
For more details, see Wadim Zudilin's answer on MathOverflow concerning the convergence of $$\sum_{n=1}^\infty \frac{1}{n^3\sin^2(n)}.$$ His comment concerning quadratic irrationals can be used to prove that if $\frac{z}{\pi}$ is a quadratic irrational, then the series converges, and similarly if $z=\pi e$ then the series diverges.
