I am looking for a proof of the following fabulous identity by Hardy and Ramanujan
$$\sum_{n = 1}^{\infty}\dfrac{1}{n^{2q - 1}}\left(a^{2q - 2}\coth\dfrac{n\pi b}{a} + (-1)^qb^{2q - 2}\coth\dfrac{n\pi a}{b}\right) \\ = \dfrac{2}{\pi ab}\sum_{k = 0}^{q}(-1)^{k - 1}\zeta(2k)\zeta(2q - 2k)a^{2q - 2k}b^{2k}$$
I'm most interested in a proof making use of complex analysis, Mellin transforms, Infinite series. However any approach is most welcomed.
Thanks.
The proof below is borrowed from this paper by Bruce C. Berndt and Armin Straub.
Let us start with another identity of Ramanujan (proved here) : $$ \frac{\pi}{2}\cot\sqrt{w\alpha}\coth\sqrt{w\beta}=\frac{1}{2w}+\frac{1}{2}\log\frac{\beta}{\alpha}+\sum_{m=1}^{\infty} \left(\frac{m\alpha\coth m\alpha} {w+m^2\alpha} +\frac{m\beta\coth m\beta} {w-m^2\beta} \right) \tag{1}$$ which holds for positive $\alpha,\beta$ with $\alpha\beta=\pi^2$.
Next we can rewrite the right hand side of $(1)$ as a geometric series to get $$\frac{\pi}{2}\cot\sqrt{w\alpha}\coth\sqrt{w\beta}=\frac{1}{2w}+\frac{1}{2}\log\frac{\beta}{\alpha}+\sum_{m=1}^{\infty} \left(\frac{1}{m}\sum_{k=0}^{\infty} \left(-\frac{w} {m^2\alpha}\right)^k\coth m\alpha- \frac{1}{m}\sum_{k=0}^{\infty} \left(\frac{w} {m^2\beta}\right)^k\coth m\beta \right) \tag{2}$$ And we can use the well known expansions of $\cot x, \coth x$ given by $$\cot x=\sum_{k=0}^{\infty} (-1)^k\frac{2^{2k}B_{2k}}{(2k)!}x^{2k-1}\tag{3a}$$ and $$\coth x=\sum_{k=0}^{\infty} \frac{2^{2k}B_{2k}}{(2k)!}x^{2k-1}\tag{3b}$$ to rewrite left hand side of $(2)$ as $$\frac{\pi} {2}\left(\sum_{k=0}^{\infty} (-1)^k\frac{2^{2k}B_{2k}}{(2k)!}(w\alpha)^{k-(1/2)}\right)\left(\sum_{j=0}^{\infty}\frac{2^{2j}B_{2j}}{(2j)!}(w\beta)^{j-(1/2)}\right)\tag{4}$$ The coefficient of $w^n$ in $(4)$ is $$\frac{\pi} {2}\cdot 2^{2n+2}\sum_{k=0}^{n+1}(-1)^{k}\frac {B_{2k}}{(2k)!}\cdot\frac{B_{2n+2-2k}}{(2n+2-2k)!}\alpha^{k-(1/2)}\beta^{n+(1/2)-k}$$ Since $\pi=\sqrt {\alpha\beta} $ we can rewrite the above as $$2^{2n+1}\sum_{k=0}^{n+1}(-1)^k\frac{B_{2k}}{(2k)!}\cdot\frac{B_{2n+2-2k}}{(2n+2-2k)!}\alpha^k\beta^{n+1-k}\tag{5}$$ Equating this with the coefficient of $w^n$ on right hand side of $(2)$ we get $$(-\alpha) ^{-n} \sum_{m=1}^{\infty} \frac{\coth m\alpha}{m^{2n+1}}-(\beta)^{-n}\sum_{m=1}^{\infty} \frac{\coth m\beta}{m^{2n+1}}= 2^{2n+1}\sum_{k=0}^{n+1}(-1)^k\frac{B_{2k}}{(2k)!}\cdot\frac{B_{2n+2-2k}}{(2n+2-2k)!}\alpha^k\beta^{n+1-k} $$ This is identical to your formula for $\alpha=\pi b/a, \beta=\pi a/b, q=n+1$ and note that your formula contains zeta values instead of Bernoulli numbers.
Ramanujan had a habit of analyzing partial fraction decomposition of various functions and deriving further identities by equating coefficients. What is really mysterious is his choice of functions like left hand side of $(1)$ on which to apply the partial fraction decomposition. And one can see that his technique avoids any complicated stuff.