What is the indefinite sum of tan(x)?
I add more details for the solution in the distinguished answer due to Anixx. First, we need the digamma function
http://en.wikipedia.org/wiki/Digamma_function
which we will call $\Psi(x)$. Important properties (from that web page) are: $\Psi(x)$ is analytic in the complex plane except at the nonpositive integers where it has simple poles. $\Psi(x+1)-\Psi(x) = 1/x$. $\Psi(x) > 0$ for $x>2$. Asymptotics:
$$
\Psi(x) = \log x - \frac{1}{2x} - \frac{1}{12x^2} + \frac{1}{120x^4} + O(x^{-6})
\qquad\text{as } x \to \infty .
$$
So, define $T(z) ={}$
$$
-\sum_{k = 1}^{\infty} \Biggl[\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) - z + 1\Biggr) + \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + z\Biggr) - \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + 1\Biggr) -
\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr)\Biggr)\Biggr]
$$
For any fixed $z$, only finitely many preliminary terms involve $\Psi$ evaluated at a nonpositive argument, and the asymptotics of the remaining terms are computed (from the asymptotics given above) as
$$
\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) - z + 1\Biggr) + \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + z\Biggr) - \Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr) + 1\Biggr) -
\Psi \Biggl(\pi \biggl(k - \frac{1}{2}\biggr)\Biggr)
$$
$=z(1-z)/(k^2\pi^2) + o(k^{-2})$ as $k \to \infty$. So the series converges absolutely except when we are at a pole of one of the preliminary terms. Now, because of absolute convergence, we may subtract term-by-term and simplify to get
$$ T(z+1)-T(z) = \sum_{k=1}^\infty\Biggl[\frac{8z}{(-\pi+2\pi k-2z)(-\pi+2\pi k+2z)}\Biggr] = \tan z . $$
And here is the plot of indefinite sum of tan(x):
Here you can see tan(x) in red and its indefinite sum is in blue.
As you can see, the indefinite sum is fairly continuous. Oleg Eroshkin's conclusion that this function should be discontinuous everywhere apparently came from a false assumption that indefinite sum of a periodic function should also be periodic.
Though it is true that as $|x|$ grows the density of the poles grows, showing the same behavior as in function $f(x)=\tan(x^2)$
The function shown on this plot is
$$T(z)=-\sum _{k=1}^{\infty } \left(\psi \left(k \pi -\frac{\pi }{2}+1-z\right)+\psi \left(k \pi -\frac{\pi }{2}+z\right)-\psi \left(k \pi -\frac{\pi }{2}+1\right)-\psi \left(k \pi -\frac{\pi }{2}\right)\right)+C$$
It can be derived from the first formula on this page:
$$\tan(x)=8x \sum_{k=1}^{\infty} \frac1{(2k-1)^2\pi^2-4x^2}$$
We notice that there is a difference of squares in the denominator and separate the terms so to obtain
$$\tan(x)=-\sum_{k=1}^{\infty}\left(\frac1{x-\pi k+\frac{\pi}2}+\frac1{x+\pi k-\frac{\pi}2}\right)$$
Now we take indefinite sum by each term to obtain the expression for T(x). All simple.
There is no reason to think there is any simple expression for solution $T$ of $$T(x + 1) - T(x) = \tan(x)$$
What we CAN find a simple solution to is this: $$T(x + \pi) - T(x) = \tan(x)$$