Using the relation$$\tan^2A=\frac2{1+\cos2A}-1,$$we can write the sum as $$S=2\frac{2+2s_1+s_2}{1+s_1+s_2+s_3}-3,$$where $s_1,$ $s_2$, and $s_3$ are respectively the sum of $$\cos\frac{2k\pi}7\quad (k=1,2,3),$$the sum of their pairwise products, and their product (i.e. the $s_k$ are the three elementary symmetric forms in the three cosines).
Now, looking at the real parts of the roots of $z^7=1$ in the Argand diagram, we see that $s_1=-\frac12$. Further, using the formula $2\cos A\cos B=\cos(A+B)+\cos(A-B)$, we can write $$s_2=\frac12\sum_{k=1}^6\cos\frac{2k\pi}7=-\frac12$$(getting the latter equality from looking at the same Argand diagram). Finally, the previous cosine product identity gives$$s_3=\frac12\!\left(\cos\frac{8\pi}7+\cos\frac{4\pi}7\right)\cos\frac{4\pi}7=\frac14\left(\cos\frac{4\pi}7+\cos\frac{12\pi}7+\cos\frac{8\pi}7+1\right)=\frac18,$$where the last identity follows by considering the same argument as for $s_1$ but taking into account that the cosine is an even function so that all the roots except $1$ pair off. Substituting the values $s_1=s_2=-\frac12$ and $s_3=\frac18$ then gives the result $S=21$.