In the book of Theoretical microfluidics by Bruus (2008) at page 49 the equation 3.48, it is argued that
$$-\frac{\Delta p}{\eta L}=-\frac{\Delta p}{\eta L} \frac{4}{\pi} \sum_{n, \text { odd }}^{\infty} \frac{1}{n} \sin \left(n \pi \frac{z}{h}\right)$$
which can be written as
$$ \pi / 4 = \sum_{n, \text { odd }}^{\infty} \frac{1}{n} \sin \left(n \pi \frac{z}{h}\right) $$ where $z\in [0,h]$, but when I calculate the RHS in Mathematica, I get
$$\frac{1}{2} i \left(\tanh ^{-1}\left(e^{-i \pi z/h}\right)-\tanh ^{-1}\left(e^{i \pi z/h}\right)\right)$$
which is not equal to $\pi/4$. So how does author argues that a term $\frac{\Delta p}{\eta L}$ that is independent of $z$ can be written as a Fouries series given above?
Addendum:
The book can be accessed by a simply googling the name of the book.

Actually yes,
$$ \frac{i}{2} \left(\tanh^{-1}\left(e^{-i\pi z/h}\right) - \tanh^{-1}\left(e^{i\pi z/h}\right)\right) = \frac{\pi}{4} $$
for any real number $0 < \frac{z}{h} < 1$. Identities of trig and hyperbolic trig functions and their inverses can be tricky to spot! (This Fourier series breaks at the interval endpoints, but this isn't an issue for most physics applications.)
The inverse hyperbolic tangent can also be written
$$ \tanh^{-1} x = \frac{1}{2}\, \ln \frac{1+x}{1-x} $$
As complex functions, both $\ln$ and $\tanh^{-1}$ can be multivalued, or the principal branch of $\tanh^{-1}$ is defined based on the principle branch of $\ln$. Mathematica always uses $\tanh^{-1}$ in the sense of the principle branch.
So if we say $w = e^{i \pi z/h}$ then
$$ \begin{align*} X &= \frac{i}{2} \left(\tanh^{-1}\left(e^{-i\pi z/h}\right) - \tanh^{-1}\left(e^{i\pi z/h}\right)\right) \\ X &= \frac{i}{2} \left(\tanh^{-1} \left(\frac{1}{w}\right) - \tanh^{-1} w\right) \\ X &= \frac{i}{4} \left(\ln \frac{1+\frac{1}{w}}{1-\frac{1}{w}} - \ln \frac{1+w}{1-w}\right) \\ X &= \frac{i}{4} \left(\ln \left(-\frac{1+w}{1-w}\right) - \ln \frac{1+w}{1-w}\right) \\ X &= \frac{i}{4} \big(\ln (-u) - \ln u \big) \end{align*} $$
where $u = \frac{1+w}{1-w}$.
$$ e^{\ln(-u) - \ln u} = \frac{-u}{u} = -1 $$
which implies that
$$ \ln(-u) - \ln u = (2k+1) \pi i $$
for some integer $k$.
Since $-1 < \mathop{\mathrm{Re}} w < 1$ and $0 < \mathop{\mathrm{Im}} w < 1$, we have $1+w$ and $1-w$ both in the first quadrant and $1-w$ in the fourth quadrant. So the quotient has $\mathop{\mathrm{Im}} u = \mathop{\mathrm{Im}} \frac{1+w}{1-w} > 0$, and using the principal branch of $\ln$ and $\tanh^{-1}$,
$$0 < \mathop{\mathrm{Im}}(\ln u) < \pi $$
$$ -\pi < \mathop{\mathrm{Im}}\!\big(\ln(-u)\big) < 0 $$
$$ -2 \pi < \mathop{\mathrm{Im}}\!\big(\ln(-u) - \ln u \big) < 0 $$
Combining the multivalue solution and the inequality, $\ln(-u)-\ln u = -\pi i$. So finally,
$$ X = \frac{i}{4} \big(\ln (-u) - \ln u \big) = \frac{\pi}{4} $$
Mathematica's answer is correct on a wider set of complex values for $\frac{z}{h}$, in regions where the infinite series converges.