<s>[INST] Expand $\tan z$ in terms of Bernoulli numbers Want to get this:
$$\tan z = \frac{1}{i}\frac{{{e^{iz}} - {e^{ - iz}}}}{{{e^{iz}} + {e^{ - iz}}}} = \frac{1}{i}\left( {1 - \frac{2}{{{e^{2iz}} - 1}} + \frac{4}{{{e^{4iz}} - 1}}} \right)$$
as a start.
Getting lost in the algebra
$$\frac{{{e^{iz}} - {e^{ - iz}}}}{{{e^{iz}} + {e^{ - iz}}}} = \frac{{{e^{iz}} + {e^{ - iz}} - 2{e^{ - iz}}}}{{{e^{ - iz}} + {e^{iz}}}} = \frac{{{e^{iz}} + {e^{ - iz}} - 2{e^{ - iz}}}}{{{e^{ - iz}} + {e^{iz}}}} = 1 - \frac{{2{e^{ - iz}}}}{{{e^{ - iz}} + {e^{iz}}}}$$
and also
$$\frac{{2{e^{ - iz}}}}{{{e^{ - iz}} + {e^{iz}}}} = \frac{2}{{{e^{2iz}} + 1}} = \frac{{ - 2 + 4}}{{{e^{2iz}} + 1}} = \frac{{ - 2}}{{{e^{2iz}} + 1}} + \frac{4}{{{e^{2iz}} + 1}}$$
Please someone, show me the right way.
 [/INST] Work backwards! We have that
$$\begin{align} {1 - \frac{2}{{{e^{2iz}} - 1}} + \frac{4}{{{e^{4iz}} - 1}}}&=\frac{e^{4iz} - 1-2({e^{2iz}} + 1)+4}{{{e^{4iz}} - 1}}\\&=\frac{e^{4iz}-2e^{2iz}+1}{{e^{4iz}} - 1}=
\frac{(e^{2iz}-1)^2}{{e^{4iz}} - 1}\\&=\frac{e^{2iz}-1}{{e^{2iz}} + 1}=\frac{{{e^{iz}} - {e^{ - iz}}}}{{{e^{iz}} + {e^{ - iz}}}}.\end{align}$$
Supplement: since Bernoulli numbers are related to the expansion of $x/(e^x-1)$, we try to write the LHS in terms of functions like $1/(w^n-1)$ where $w=e^{iz}$,
$$\frac{{{e^{iz}} - {e^{ - iz}}}}{{{e^{iz}} + {e^{ - iz}}}}=\frac{w^2-1}{w^2 + 1}=1-\frac{2}{w^2 + 1}=1-\frac{2(w^2-1)}{w^4 - 1}\\=1-\frac{2(w^2+1)-4}{w^4 - 1}=1-\frac{2}{w^2 - 1}+\frac{4}{w^4 - 1}.$$
</s>