Show $\frac{\pi}{\cos \pi z}=4\sum\limits_{n=0}^\infty \frac{(-1)^n(2n+1)}{(2n+1)^2-4z^2}$ using partial fraction decomposition of $\cot$ and $\tan$ I am asked to show that $\frac{\pi}{\cos \pi z}=4\sum\limits_{n=0}^\infty \frac{(-1)^n(2n+1)}{(2n+1)^2-4z^2}$. Here is what I have got so far,
$\frac{\pi}{\cos (\pi z)}=\frac{\pi}{\sin(\pi(\frac{1}{2}-z))}=$
$\pi[\cot(\pi(\frac{1}{2}-z))+\tan(\frac{\pi}{2}(\frac{1}{2}-z))]=\frac{1}{(\frac{1}{2}-z)}+\sum\limits_{n=1}^\infty \frac{2(\frac{1}{2}-z)}{(\frac{1}{2}-z)^2-n^2}+\sum\limits_{n=0}^\infty \frac{-2(\frac{\pi}{2}(\frac{1}{2}-z))}{(\frac{\pi}{2}(\frac{1}{2}-z))^2-(n+\frac{1}{2})^2\pi^2}$
I cannot see where to go from here. Any suggestions or hints would be appreciated.

Since
$
\frac{1}{\sin z}=\cot z+\tan\left(\frac{z}{2}\right)
$, and using the partial fraction decomposition of the tangent and cotangent
$$
\pi \tan(\pi z) = 8z\sum_{n=0}^{+\infty}\frac{1}{(2n + 1)^2 − 4z^2}\quad\text{and}\quad
\pi \cot(\pi z) = \frac{1}{z}+2z\sum_{n=1}^{+\infty}\frac{1}{z^2 − n^2}
$$
we have
\begin{align}
\frac{\pi}{\sin \pi z}&=\frac{1}{z}+2z\left[\sum_{n=1}^{+\infty}\frac{1}{z^2 − n^2}-\sum_{n=0}^{+\infty}\frac{2}{z^2-(2n + 1)^2 }\right]\\
&=\frac{1}{z}+2z\left[\frac{1}{z^2 − 1^2}+\frac{1}{z^2 − 2^2}+\frac{1}{z^2 − 3^2}+\frac{1}{z^2 − 4^2}+\frac{1}{z^2 − 5^2}+\cdots\right.\\
&\left.\qquad\qquad\quad-\frac{2}{z^2-1^2}-\frac{2}{z^2-3^2}-\frac{2}{z^2-5^2}\right]\\
&=\frac{1}{z}+2z\left[-\frac{1}{z^2 − 1^2}+\frac{1}{z^2 − 2^2}-\frac{1}{z^2 − 3^2}+\frac{1}{z^2 − 4^2}-\frac{1}{z^2 − 5^2}+\cdots\right]
\end{align}
that is
$$
\frac{\pi}{\sin \pi z}=\frac{1}{z}+\sum_{n=1}^{+\infty}(-1)^{n-1}\frac{2z}{n^2-z^2}
$$
Observing that $\sin\left(\pi\left(\frac{1}{2}-z\right)\right)=\cos \pi z$, upon writing $\frac{2z}{n^2-z^2}=\frac{1}{n-z}-\frac{1}{n+z}$ and then replacing $z$ with $\frac{1}{2}-z$, we have
$$
\frac{\pi}{\cos \pi z}=\frac{2}{1-2z}+\left(\frac{2}{1+2z}-\frac{2}{3-2z}\right)-\left(\frac{2}{3+2z}-\frac{2}{5-2z}\right)+-\cdots
$$
Here we may omit the parentheses and combine pairs of terms having the same sign; this yields
$$
\frac{\pi}{\cos \pi z}=\frac{4\cdot 1}{1^2-4z^2}-\frac{4\cdot 3}{3^2-4z^2}+\frac{4\cdot 5}{5^2-4z^2}-+\cdots
$$
that is
$$
\frac{\pi}{\cos \pi z}=4\sum\limits_{n=0}^\infty (-1)^n\frac{(2n+1)}{(2n+1)^2-4z^2}
$$
