A formula of Ramanujan for $\cot\sqrt {w\alpha} \coth\sqrt{w\beta} $ While trying to answer this question I stumbled on a paper by Bruce C. Berndt which contains the following formula by Ramanujan $$\frac{\pi}{2}\cot\sqrt{w\alpha}\coth\sqrt{w\beta}=\frac{1}{2w}+\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 is supposed to hold for all positive numbers $\alpha, \beta$ with $\alpha\beta=\pi^2$. 
Berndt mentions that this formula is wrong and missing a term. The corrected version stands as $$\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{2}$$ for $\alpha>0<\beta,\alpha\beta=\pi^2$. Bruce gives some references which contain a proof of the above formula or its equivalents.
Bruce himself derives the above identity by using a change of variables in the following identity established by R. Sitaramchandrarao $$\pi^2xy\cot (\pi x) \coth (\pi y) =1+\frac{\pi^2}{3}(y^2-x^2)-2\pi xy\sum_{n=1}^{\infty} \left(\frac{y^2\coth (\pi n x/y)} {n(n^2+y^2)}-\frac{x^2\coth(\pi n y/x)}{n(n^2-x^2)}\right) \tag{3}$$ Ramanujan gave a similar (but wrong) formula and Sitaramachandrarao fixed it to arrive at $(3)$.
The derivation of $(2)$ from $(3)$ is not that difficult. The RHS of $(3)$ is modified using the identities $$\frac{y^2} {n(n^2+y^2)}=\frac{1}{n}-\frac{n}{n^2+y^2},\frac{x^2}{n(n^2-x^2)}=\frac{n}{n^2-x^2}-\frac{1}{n}$$ and $$\coth z =1+\frac{2}{e^{2z}-1}$$ The derivation also involves a transformation formula for logarithm of Dedekind eta function. However the proof of $(3)$ is omitted in Berndt's paper. 
Unfortunately I have not been able to find those references online which contain a proof for $(2)$ or $(3)$. It is also mentioned that the formula could be proved using Mittag-Leffler expansion but I am barely a novice in complex analysis.

It is desirable to find a direct proof of the above result $(2)$ (or $(3)$) which avoids complex analytic methods. I tried to multiply the partial fractions of $\cot a$ and $\coth b$ but I could not manage to get the desired result.

 A: Here are the exceirpts from "Ramanujan's Lost Notebook, Part 4" by George E. Andrews, Bruce C. Berndt pages 273 and 274 :


A: I thought it would be worthwhile to at least mention how to use the Mittag-Leffler pole expansion theorem to show that $$ \begin{align}\frac{\pi}{2}\cot\sqrt{w\alpha}\coth\sqrt{w\beta} &=\frac{1}{2w}+ \frac{b-a}{6} +\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) \\ &-2 \sum_{m=1}^{\infty} \frac{1}{m} \left(\frac{1}{e^{2m \alpha}-1}- \frac{1}{e^{2m \beta}-1}\right). \end{align} $$

Using the princicpal branch of the square root, and under the assumption that $\alpha$ and $\beta$ are positive parameters such that $\alpha \beta = \pi^{2}$, let $$f(w) = \frac{\pi}{2} \cot (\sqrt{w \alpha}) \coth (\sqrt{w \beta}) - \frac{1}{2w}.$$
The above function is meromorphic with simple poles at $w = \frac{m^{2}\pi^{2}}{\alpha} = m^{2} \beta$ and $w = -\frac{m^{2}\pi^{2}}{\beta} = -m^{2} \alpha$, where $m$ is a positive integer.
(Separately, $\cot(\sqrt{w \alpha})$ and $\coth(\sqrt{w \beta})$ have branch points at the origin,  but their product has a simple pole at the origin.)
At $w= m^{2} \beta$, the residue of $f(w)$ is $$\begin{align} \lim_{w \to m^{2} \beta} \frac{\pi}{2}\frac{\coth (\sqrt{w \beta})}{\left( \tan(\sqrt{w \alpha}\right)'} &=  \lim_{w \to m^{2} \beta} \, \frac{\pi}{2}\frac{2\coth (\sqrt{w \beta}) \,  \sqrt{w \alpha}}{\alpha \sec^{2} (\sqrt{w \alpha)}} \\ &= \frac{\pi \coth(m \beta) m \pi }{\alpha} \\  &= m \beta \coth(m \beta). \end{align}$$
Similarly, at $w = - m^{2} \beta $, the residue of $f(w)$ is $$\begin{align} \lim_{w \to -m^{2} \alpha} \frac{\pi}{2}\frac{\cot (\sqrt{w \alpha})}{\left( \tanh(\sqrt{w \beta}\right)'} &=  \lim_{w \to -m^{2} \alpha} \, \frac{\pi}{2}\frac{2\cot (\sqrt{w \alpha}) \,  \sqrt{w \beta}}{\beta \operatorname{sech}^{2} (\sqrt{w \beta)}} \\ &= \frac{-\pi i  \coth(m \alpha)i m \pi }{\beta } \\ &= m \alpha \coth(m \alpha). \end{align} $$
And the Laurent expansion of $\frac{\pi}{2} \cot (\sqrt{w \alpha}) \coth (\sqrt{w \beta})$ about the origin is $$\frac{\pi}{2 \sqrt{\alpha \beta}} \frac{1}{w} + \frac{\pi(\beta-\alpha)}{6 \sqrt{\alpha \beta}} + \mathcal{O}(w) = \frac{1}{2w} + \frac{\beta- \alpha}{6} + \mathcal{O}(w). $$

The most basic version of the Mittag-Leffler pole expansion theorem states that if $f(w)$ is a meromorphic function with simple poles at $w= a_{1}, a_{2}, \ldots$ (where $0 < |a_{1}| < |a_{2}| < \ldots$ ) with associated residues $b_{1}, b_{2}, \ldots$, then 
$$f(w) = \lim_{w \to 0} f(w) + \sum_{m=1}^{\infty} \left(\frac{b_{m}}{w-a_{m}} + \frac{b_{m}}{a_{m}} \right) $$ provided that $f(s)$ is bounded on circles centered at the origin that stay away from the poles.
This formula results from evaluating  $$\lim_{M \to \infty} \oint_{C_{M}} \frac{f(s)}{s(s-w)} \mathrm ds $$ where $C_{M}$ is a circle centered at the origin that encloses $M$ poles, and $w$ is inside the circle.

Applying the Mittt-Leffler pole expansion theorem to 
$$\frac{\pi}{2}\cot\sqrt{w\alpha}\coth\sqrt{w\beta}-\frac{1}{2w}, $$ we get
$$ \begin{align} \frac{\pi}{2}\cot\sqrt{w\alpha}\coth\sqrt{w\beta}-\frac{1}{2w} &= \frac{b-a}{6} + \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) \\ &+ \sum_{m=1}^{\infty} \frac{1}{m} \left(\coth(m \beta) - \coth(m \alpha) \right), \end{align} $$
where $$ \begin{align} \sum_{m=1}^{\infty} \frac{1}{m} \left(\coth(m \beta) - \coth(m \alpha) \right) &= \sum_{m=1}^{\infty} \frac{1}{m} \left(\coth(m \beta) -1 -\left(\coth(m \alpha)-1 \right) \right)  \\ &= - 2 \sum_{m=1}^{\infty} \frac{1}{m} \left(\frac{1}{e^{2 m \alpha}-1}-\frac{1}{e^{2m \beta}-1} \right). \end{align}$$
