Proving $48\sum\limits_{n\ge1}{e^{2n}(1+e^{4n})\over(1-e^{4n})^2}=24\pi^2\sum\limits_{n\ge1}{e^{\pi^2n}(1+e^{2\pi^2n})\over(1-e^{2\pi^2n})^2}+\pi^2-2$ 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?
 A: An answer without reference to any special functions.
Define the complex valued function
\begin{equation}
f(z)=\cot(\pi z)\frac{\cosh(\pi a z)}{\sinh^2(\pi a z)}    
\end{equation}
We have three types of residues (3rd, 2nd and first order singularities), given by
\begin{equation}
\begin{split}
&\text{res}(f(z),z=0)= \frac{a^2-2}{6 a^2 \pi}\\
&\text{res}(f(z),z=z_n)= \frac{1}{\pi}\frac{\cosh(\pi a n)}{\sinh^2(\pi a n)} , \quad z_n \in \frac{i}{a}\{\pm1,\pm2\,...\} \\
&\text{res}(f(z),z=z_n)=  \frac{1}{\pi a^2} \frac{(-1)^n}{\sinh^2(\pi n/a )}  ,\quad z_n \in \{\pm1,\pm2\,...\} 
\end{split}  
\end{equation}
by residue theorem we have (note that we have used symmetry $n \Longleftrightarrow -n$)
\begin{equation}
-\frac{a^2-2}{12 a^2}=\sum_{n>0}\frac{\cosh(\pi a n)}{\sinh^2(\pi a n)}+\frac{1}{ a^2}\sum_{n>0}\frac{(-1)^n}{\sinh^2(\pi n/a )}
\end{equation}
where we integrated $f(z)$ over a big rectangle in $\mathbb{C}$, with vertices chosen such that we don't hit any singularity (f.e. half integer vertices will do). Afterwards we took the limit of infinite size.
There is something to be said about the vanishing of the boundary terms, but we keep it informal and say that on vertical segments this is due to exponential decay of the integrand and on horizontal segements it can be justified by an easy symmetry argument together with the fact that $\cot(\pi z)$ is bounded by a constant on such paths.
Having this out of the way, easy algebra gives $2\sinh^{-2}(2 \pi n/a)-\sinh^{-2}( \pi n/a)=-2 \tfrac{\cosh(2\pi n/a)}{ \sinh^2(2\pi n/a)}$ so we can reformulate
\begin{equation}
-\frac{a^2-2}{12 a^2}=\sum_{n>0}\frac{\cosh(\pi a n)}{\sinh^2(\pi a n)}-\frac{2}{ a^2}\sum_{n>0}\frac{\cosh(2\pi n/a)}{\sinh^2(2 \pi n/a )}
\end{equation}
Now consider the special case $a=\pm\pi$
\begin{equation}
\begin{split}
-\frac{\pi^2-2}{12 \pi^2}= \sum_{n>0}\frac{\cosh(\pi^2 n)}{\sinh^2(\pi^2  n)}-\frac{2}{ \pi^2}\sum_{n>0}\frac{\cosh(2 n)}{\sinh^2(2 n )}\\
\sum_{n>0}\frac{\cosh(2 n)}{\sinh^2(2 n )}= \frac{\pi^2}{2}\sum_{n>0}\frac{\cosh(\pi^2 n)}{\sinh^2(\pi^2  n)}+\frac{\pi^2-2}{24}
\end{split}
\end{equation}
which is equivalent to OPs statement up to trivial transformations ($a=\pm \sqrt{2/7}$ gives an even prettier identity).

NB:
We can derive a lot of complicated summation formulas this way. For example using $\sin(\pi z)^{-1}$ instead of $\cot(\pi z)$ we can derive, setting $a=1$ :
$$
\sum_{n>0}(-1)^n \frac{\cosh(\pi n)}{\sinh^2(\pi n)}=-\frac{1}{12}
$$
Holy shit!
A: 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.
