You are right in that it doesn't converge for any $\phi$ (as the limit of the summands isn't $0$). I'm guessing that Mathematica did something like the following behind the scenes: $$\sum_{n=0}^\infty \frac{\cos\left(\left(2n+1\right)\phi\right)}{\cos^{2n+1}\left(\phi\right)} = \sum_{n=0}^\infty \frac{\frac{e^{i\left(\left(2n+1\right)\phi\right)}+e^{-i\left(\left(2n+1\right)\phi\right)}}{2}}{\left( \frac{e^{i\phi}+e^{-i\phi}}{2} \right)^{2n+1}}$$
which would be equal to $$\sum_{n=0}^\infty \frac{e^{i\left(\left(2n+1\right)\phi\right)}}{\left(e^{i\phi}+e^{-i\phi} \right)^{2n+1}}2^{2n}+\sum_{n=0}^\infty \frac{e^{-i\left(\left(2n+1\right)\phi\right)}}{\left(e^{i\phi}+e^{-i\phi} \right)^{2n+1}}2^{2n}$$ if both sums converged. The first sum is $-\frac{e^{i\phi}\cos(\phi)}{-1+\cos(2\phi)+2i\sin(2\phi)}$ when $3e^{-2\Im(\phi)}-e^{2\Im(\phi)} < 2\cos(2\Re(\phi))$. The second sum is $\frac{1}{-1+e^{2ix}+2i\tan(x)}$ when $3e^{2\Im(\phi)}-e^{-2\Im(\phi)} < 2\cos(2\Re(\phi))$. Add these up and "ignore" the restrictions on $\phi$ to get what Mathematica got.