TITLE: Series representation for 1/cos x
QUESTION [8 upvotes]: Why does the summation 
\begin{equation*}
\frac{1}{\cos x}=\sum_{n=1}^\infty \frac{(-1)^n(2n-1)\pi }{x^2-\left (n-\frac{1}{2}\right )^2\pi^2}
\end{equation*}
hold?

REPLY [3 votes]: You can find such partial fraction expansions given as examples in many texts on complex analysis. For example, you will find a derivation of this series in Example 1 at this link to Markushevich and Silverman's book.  It uses "Cauchy's theorem on partial fraction expansions", given a few pages earlier at this link.  
Example 2 gives the series for $\cot$, although from the preview I can't see whether $\tan$ and $\csc$ are included. The analogous series for $\tan$ is derived on Wikipedia.  Each of these series can be useful for evaluating numerical series.  For example, taking $x=0$ in your series you get 
$$\frac{\pi}{4}=1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\cdots.$$
 And although it is not directly related to your question, I thought I'd add in light of the recent question on evaluating the sum of the reciprocals of the squares that if you take the partial fraction series 
$$\tan(x) = \sum_{k=0}^{\infty} \frac{-2x}{x^2 - \left(k + \frac{1}{2}\right)^2\pi^2},$$
divide by $x$ and let $x$ go to $0$, rearranging yields 
$$\frac{\pi^2}{8}=1+\frac{1}{9}+\frac{1}{25}+\frac{1}{49}+\cdots,$$
which in turn (because the sum over the evens is $\frac{1}{4}$ the total sum) leads to 
$$\frac{\pi^2}{6}=1+\frac{1}{4}+\frac{1}{9}+\frac{1}{16}+\cdots.$$