I am looking for a direct proof of the identity $$2\sum_{n\ge1}\frac{e^{2n}(1+e^{4n})}{(1-e^{4n})^2}=\pi^2\sum_{n\ge1}\frac{e^{\pi^2n}(1+e^{2\pi^2n})}{(1-e^{2\pi^2n})^2}+\frac{\pi^2-2}{24}\tag1$$ which can be shown by evaluating in two ways \begin{align}\sum_{k\ge1}\frac{(-1)^k}{\sinh^2k}&=\sum_{k\ge1}\frac2{\sinh^22k}-\sum_{k\ge1}\frac1{\sinh^2k}\tag{first method}\\&=-\pi^2\sum_{k\ge1}\frac{\cosh\pi^2k}{\sinh^2\pi^2k}-\frac{\pi^2-2}{12}\tag{second method}\end{align} The first equality follows directly from the definition, and Mathematica evaluates it to $$\frac12\psi_{e^2}^{(1)}(1)+\frac12\psi_{e^2}^{(1)}\left(1-{i\pi\over2}\right)-\psi_e^{(1)}(1)-\psi_e^{(1)}(1-i\pi)=-4\sum_{n\ge1}\frac{e^{2n}(1+e^{4n})}{(1-e^{4n})^2}$$ where $\displaystyle\psi_q^{(1)}(z)=\log q+\log^2q\sum_{n\ge0}\frac{q^{n+z}}{(1-q^{n+z})^2}$ is the first derivative of the $q$-digamma function.
The second equality follows by substituting $z\mapsto iz$ in the Mittag-Leffler expansion of $\csc^2z$ and interchanging the order of summation. Now $$\sum_{k\ge1}\frac{\cosh\pi^2k}{\sinh^2\pi^2k}=\frac1{\pi^4}\psi_{e^{\pi^2}}^{(1)}(1)-\frac1{\pi^4}\psi_{e^{\pi^2}}^{(1)}(1-i\pi)=2\sum_{n\ge1}\frac{e^{\pi^2n}(1+e^{2\pi^2n})}{(1-e^{2\pi^2n})^2}$$ so equating the two series gives us $(1)$.
But can $(1)$ be proved directly using the theory of theta functions or otherwise?
Let us write $$g(x) =\sum_{n\geq 1}\frac{e^{-nx}(1+e^{-2nx})}{(1-e^{-2nx})^2},x>0\tag{1}$$ Then the identity in question is $$48g(2)=24\pi^2g(\pi^2)+\pi^2-2\tag{2}$$ As per your comment if we write $q=e^{-x} $ then $$g(x) =\sum_{n\geq 1}\frac{q^n(1+q^{2n})}{(1-q^{2n})^2}=\frac{2P(q^2)-P(q)-1}{24}\tag{3}$$ where $P(q) $ is a function defined by Ramanujan as $$P(q) =1-24\sum_{n\geq 1}\frac{nq^n}{1-q^n}\tag{4}$$ The expression $$2P(q^2)-P(q)=1+24g(x)=f(x)\text{ (say)} \tag{5}$$ and its generalization $mP(q^m) - P(q) $ were studied extensively by Ramanujan. In his paper Modular equations and approximations to $\pi$ he evaluated such expressions in closed form in terms of elliptic integrals and moduli related to nome $q$ and used them to derive many wonderful series for $1/\pi$.
Using Ramanujan's technique described in his paper one obtains $$2P(q^4)-P(q^2)=\frac{4KL}{\pi^2}(k'+l)\tag{6}$$ where $k, K$ correspond to $q$ and $l, L$ correspond to $q^2$. To avoid confusion the exact relations are $$K=K(k) =\int_{0}^{\pi/2}\frac{dx}{\sqrt{1-k^2\sin^2x}},k'=\sqrt{1-k^2},K'=K(k'),\\ l=\frac{1-k'}{1+k'},l'=\sqrt{1-l^2},L=K(l),L'=K(l'),q=e^{-\pi K'/K}\\ L=\frac{1+k'}{2}\cdot K, L'=(1+k') K'$$ The last two equations show that $L'/L=2K'/K$ so that $q^2=e^{-\pi L'/L} $. Using these relations we can simplify $(6)$ to get $$2P(q^4)-P(q^2)=\frac{2K^2}{\pi^2}(1+k'^2)\tag{7}$$ Using Landen transformation one can replace $q^2$ with $q$ in $(7)$ to get the value of $2P(q^2)-P(q)$. Under this transformation $K$ is replaced by $(1+k)K$ and $k$ is replaced with $2\sqrt{k}/(1+k)$. A little algebra then gives us $$2P(q^2)-P(q)=\frac{4K^2}{\pi^2}(1+k^2)\tag{8}$$ There is another transformation where we exchange $k$ with $k'$ so that $K, K'$ are interchanged and $q$ is replaced by $q'=\exp(-\pi K/K') $. Using this on $(7)$ we get $$2P(q'^4)-P(q'^2)=\frac{2K'^2}{\pi^2}(1+k^2)$$ We now note that if $q=e^{-x} $ so that $x=\pi K'/K$ then $q'=e^{-\pi K/K'} =e^{-\pi^2/x}$ and then $$2P(q'^4)-P(q'^2)=\frac{2x^2K^2}{\pi^4}(1+k^2)\tag{10}$$ In terms of $f(x) $ the equations $(8),(10)$ can be written as $$f(x) =(4K^2/\pi^2)(1+k^2),f(2\pi^2/x)=(2x^2K^2/\pi^4)(1+k^2)$$ so that $$x^2f(x)=2\pi^2f(2\pi^2/x)\tag{11}$$ The identity in question is obtained by putting $x=2$ in above equation.