How to prove an identity of Gauss for the logarithm of Jacobi theta function? P.444 of volume 3 of Gauss's Nachlass includes the following identity for the logarithm of $\vartheta_3(x)$:
$$\mathbb{log}(1+2x+2x^4+2x^9+\cdots) = \frac{2x}{1+x}+\frac{2x^3}{3(1+x^3)}+\frac{2x^5}{5(1+x^5)}+\cdots,$$
and he apparently somehow used this identity to derive the infinite series expression for $\vartheta^4_3(x)$, which is the generating function for the sum of four squares function $r_4(n)$ (this is Jacobi's four squares theorem). As can be seen from the series, it is a kind of Lambert series $\sum_{n=1}^{\infty}a_n\frac{q^n}{1-q^n}$ in which $q=-x$ and $a_{2k+1} = -\frac{2}{2k+1}, a_{2k}=0$.
When I tried to prove Gauss's identity (in order to help myself answer this question), I thought it makes sense to use the Jacobi triple product identity to express $\vartheta_3(x)$ and then to use certain well known relations between the logarithm of infinite products and Lambert series. This led me to the following attempt to prove Gauss's identity:
$$\vartheta_3(q) = \prod_{n=1}^{\infty}(1-q^{2n})\prod_{n=1}^{\infty}(1+q^{2n-1})^2 = \prod_{n=1}^{\infty}(1-q^{2n})(\frac{\prod_{n=1}^{\infty}(1+q^n)}{\prod_{n=1}^{\infty}(1+q^{2n})})^2$$
and by converting the logarithm of infinite product to an infinite sum of logarithms one gets the following linear combination of certain Lambert series:
$$\mathbb{log}(\vartheta_3(q)) = -\sum_{n=1}^{\infty}\frac{1}{n}\frac{q^{2n}}{1-q^{2n}}+2(\sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{n}\frac{q^n}{1-q^n}-\sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{n}\frac{q^{2n}}{1-q^{2n}})$$
and after some simplifications I arrived at the following expression:
$$\mathbb{log}(\vartheta_3(q))= \sum_{n=1}^{\infty}\frac{(-1)^{n-1}}{n}(\frac{2q^n+(-1)^{n}q^{2n}}{1-q^{2n}})$$
I checked the first terms of my expression and Gauss's identity and they coincide, so I guess I did not make mistakes, but I cannot see a way of transforming my linear combination of Lambert series into Gauss form; there is a "trick" here that I have not figured out yet, despite repeating attempts to show equivalence to Gauss's identity.
So my question is, in general, how to prove Gauss's identity for $\mathbb{log}(\vartheta_3(q))$? and in particular, how to move from my final expression to Gauss's form (it will be much appreciated by me if someone will continue my attempt)?
 A: This is not an answer and I've got to run. Take $n$ odd; then
$$ \frac{2q^n - q^{2n}}{1-q^{2n}} = 
   \frac{2q^n - 2q^{2n}}{1-q^{2n}}  + \frac{q^{2n}}{1-q^{2n}} =   
 2 \frac{q^n(1-q^n)}{ 1-q^{2n}} + \frac{q^{2n}}{1-q^{2n}} =   
 2 \frac{q^n}{ 1+q^n} + \frac{q^{2n}}{1-q^{2n}}. $$
Looks like this may work if you rearrange some terms ($n$ and $2n$ etc.)
A: I somehow missed that trick in my previous attempts but franz lemmermeyer's useful comment was a sort of guidance that made it clear to me how to resolve this question.
Lets look at the seperate cases of odd $n$ and even $n$:
$$n=2k-1: \sum_{k=1}^{\infty}\frac{1}{2k-1}\frac{2q^{2k-1}-q^{4k-2}}{1-q^{4k-2}} = \sum_{k=1}^{\infty}\frac{1}{2k-1}(\frac{2q^{2k-1}}{1+q^{2k-1}}+\frac{q^{4k-2}}{1-q^{4k-2}})$$
$$n=2k:-\sum_{k=1}^{\infty}\frac{1}{2k}\frac{2q^{2k}+q^{4k}}{1-q^{4k}} = - \sum_{k=1}^{\infty}\frac{1}{2k}(\frac{2q^{2k}}{1-q^{2k}}-\frac{q^{4k}}{1-q^{4k}})$$
where each simplification made use of the factorization of the denominator into $q^{2n}-1=(q^n+1)(q^n-1)$, as in lemmermeyer's comment. Since the first term in the result for $n=2k-1$ is equal to the desired result (Gauss's identity), all that is needed is to show that the sum of the other three terms is equal to zero.
I other words, we need to show:
$$\sum_{k=1}^{\infty}\frac{1}{2k-1}\frac{q^{4k-2}}{1-q^{4k-2}}+\sum_{k=1}^{\infty}\frac{1}{2k}\frac{q^{4k}}{1-q^{4k}}=\sum_{k=1}^{\infty}\frac{1}{2k}\frac{2q^{2k}}{1-q^{2k}}$$
Lets substitute now $z=q^2$, and this equality gets the form:
$$\sum_{k=1}^{\infty}\frac{1}{2k-1}\frac{z^{2k-1}}{1-z^{2k-1}}+\sum_{k=1}^{\infty}\frac{1}{2k}\frac{z^{2k}}{1-z^{2k}}=\sum_{k=1}^{\infty}\frac{1}{k}\frac{z^{k}}{1-z^{k}}$$
And this equality is true because the right side is a full Lambert series while the two sums in the left side are partial sums of the same Lambert series - the first runs on odd indices and the second on even indices. These sums add up to the full Lambert series on the right side, and therefore the proof is completed.
A: Let $$f(q) =\sum_{n=1}^{\infty} \frac{q^n} {n(1-q^n)}\tag{1}$$ and $$g(q) =\sum_{n=1}^{\infty} \frac{q^n} {n(1+q^n)}\tag{2}$$ then we have $$f(q) - g(q) =2f(q^2)\tag{3}$$ Let $$h(q) =\sum_{n=1}^{\infty} \frac{q^{2n-1}}{(2n-1)(1+q^{2n-1})}\tag{4}$$ then we have $$h(q) +\frac{1}{2}g(q^2)=g(q)$$ so that $$h(q) =g(q) - \frac {g(q^2)}{2}$$ and using $(3)$ we get $$2h(q) =2f(q)-5f(q^2)+2f(q^4)\tag{5}$$ We have to prove that $$\vartheta_3 (q) =\exp(2h(q))\tag{6}$$ The key thing to observe is that $$f(q) =-\sum_{n=1}^{\infty}\log(1-q^n)$$ (use Taylor expansion of $\log(1-q^n)$ and exchange order of summation) so that $$\exp(f(q)) =\prod_{n=1}^{\infty} (1-q^n)^{-1}\tag{7}$$ Using $(5),(7)$ we get
\begin{align}
\exp(2h(q))&=\prod_{n=1}^{\infty} \frac{(1-q^{2n})^5}{(1-q^n)^2(1-q^{4n})^2}\notag\\
&=\prod_{n=1}^{\infty} \frac{(1-q^{2n})^3}{(1-q^n)^2(1+q^{2n})^2}\notag\\
&=\prod_{n=1}^{\infty} \frac{(1-q^{2n})(1+q^n)^2}{(1+q^{2n})^2}\notag\\
&=\prod_{n=1}^{\infty}(1-q^{2n})(1+q^{2n-1})^2\notag\\
&=\vartheta_3(q)\notag
\end{align}
