This is part of a past exam question from a second year undergraduate complex variable theory course.
I am attempting to show that the integral in the title tends to zero as n goes to infinity.
The motivation is to show that $\sum_{n=0}^\infty (-1)^n/(2n+1) = \pi/4$. The residue theorem gives us that the integral "at radius infinity" is proportional to $\sum_{n=0}^\infty (-1)^n/(2n+1) - \pi/4$. We then need to show using some other method that as n tends to infinity, the integral tends to zero and the result will immediately follow.
This could be achieved by showing that $sec(z)$ is bounded on a circle of radius $n\pi$ by something which tends to zero as n goes to infinity (I have explained how this would work in the final paragraph * ).
It is possible, although unlikely, that the question is incorrect, so responses making an argument of that nature are also welcome (if the problem is soluble but only using more advanced machinery then I'd also like to know that this is the case).
I could happily show using M-L estimation that if we had instead $1/(z^mcos(z))$ for any $m>1$ then this integral would tend to zero. The idea in that case is that since the length of the countour is $2n\pi^2$ and $\lvert z \rvert = n\pi$ everywhere on the contour, then we end up with $L/\lvert z^m \rvert$ tending to zero as n goes to infinity (the power of n on the denominator is greater than that on the numerator), and we need only show that the sec component is bounded in absolute value by some constant $\kappa$ (for which we mimic a long and somewhat hand-wavey argument from an example in the relevant lecture notes). Once this happens we have that the integral is bounded in absolute value by $ML=2n\pi^2 * 1/(n\pi)^m * \kappa = constants * 1/n^{m-1}$ which goes to zero as n goes to infinity, as we needed.
In the $n=1$ case however, this is only good enough to give us that the integral is bounded by a constant (and doesn't diverge) wheras we need the stronger requirement that it actually tends to zero. That takes me back to *
$$\begin{align} \oint_{|z|=n\pi}\frac{1}{z\cos(z)}\,dz&=\int_0^{2\pi}\frac{1}{(n\pi)e^{i\phi}\left(\frac{e^{i(n\pi)e^{i\phi}}+e^{-i(n\pi)e^{i\phi}}}{2}\right)}\,i(n\pi)e^{i\phi}\,d\phi\\\\ &=2i\,\int_0^{2\pi} \frac{1}{e^{i(n\pi)e^{i\phi}}+e^{-i(n\pi)e^{i\phi}}}\,d\phi\\\\ &=2i\,\int_0^{2\pi} \frac{1}{e^{-(n\pi)\sin(\phi)}e^{i(n\pi)\cos(\phi)}+e^{(n\pi)\sin(\phi)}e^{-i(n\pi)\cos(\phi)}}\,d\phi\\\\ &=4i\,\int_0^{\pi} \frac{1}{e^{-(n\pi)\sin(\phi)}e^{i(n\pi)\cos(\phi)}+e^{(n\pi)\sin(\phi)}e^{-i(n\pi)\cos(\phi)}}\,d\phi\\\\ &\to 0\,\,\text{as}\,\,n\to \infty \end{align}$$