To my surprise, there isn’t much information about the Fourier series of $\tan(x)$ on the internet. The Fourier series is $$\tan(x)=2\sum^\infty_{n=1}(-1)^{n-1}\sin(2nx)$$
It is well known that if $f(a^-)=p$ and $f(a^+)=q$, then its Fourier series converges to $\frac{p+q}2$ at $a$.
However, in the case $f(x)=\tan(x)$ and $a=\frac\pi2$, $p=\infty$ and $q=-\infty$. My questions are
What value does the Fourier series of $\tan(x)$ converge to at $\frac\pi2$? Am I allowed to say that it converges to $\lim_{N\to\infty}\frac{N+(-N)}2=0$?
Moreover,
On the whole complex plane, where does not the Fourier series converges to the original function except (possibly) the poles?
Thanks in advance.
This may be well known, but it is not true. Additional assumptions on $f$ are required, such as: "$f$ is bounded with finitely many intervals of monotonicity" or (more general) "$f$ is a function of bounded variation". In whatever form, this result (a theorem of Dirichlet) does not apply to a highly singular function such as $\tan x$, which is not even integrable.
Neither do other classical theorems on the convergence of Fourier series. And indeed, the series $$ 2\sum^\infty_{n=1}(-1)^{n-1}\sin(2nx) $$ does not converge at any points other than $x=\pi k/2$, $k\in\mathbb{Z}$ (see Find all $x$ such that lim $\sin (nx)$ exists). At these points its sum is indeed $0$, which reflects the symmetries of the tangent function: $$ \tan\left(\frac{\pi k}{2} - x\right) = -\tan\left(\frac{\pi k}{2} + x\right) $$ but is not a consequence of the Dirichlet theorem.
Perhaps the reason is that the aforementioned lack of convergence of the series. Placing the equality sign between it and $\tan x$ is not justified.