Prove that $\sum_{n=1}^{\infty}\frac{q^n}{1+q^{2n}}=\sum_{n=1}^{\infty}(d_1(n)-d_3(n))q^n$ Prove that $$\sum_{n=1}^{\infty}\frac{q^n}{1+q^{2n}}=\sum_{n=1}^{\infty}(d_1(n)-d_3(n))q^n$$ where $d_1(n)$ is the number of divisors of $n$ congruent to $1$ modulo $4$ and $d_3(n)$  is the number of divisors of $n$ congruent to $3$ modulo $4$. I tried using the geometric series and interchanging the sum but that did not yield anything useful. I would prefer a algebraic solution rather than a one that depends on partitions but both are welcome.
Thanks!
 A: There is a small typo: $d_1(n) $ is the number of divisors congruent to 1 $\pmod{4}$, and similarly for $d_3(n) $.
Let's open the geometric series:
$$ \sum_n \sum_k q^n (-1) ^k q^{2nk} = \sum_{n, k} q^{n(2k+1) } (-1) ^k$$
Now we should group the terms depending on the exponent of $q$. For a given $m$ , which $n, k$ are such that $n(2k+1) =m$ ?
This happens exactly when we have an odd divisor $d=2k+1$ of $m$. The number $n$ will be then determined by $n= m/d$. Now we group the summands depending on the exponent of $q$ as we promised, then we use the substitution $d=2k+1$ :
$$ \sum_m \sum_{n(2k+1)= m } q^{m} (-1) ^k = \sum_m q^m \sum_{d \mid m \text{ odd}} (-1) ^{\frac{d-1}{2}}$$
Let's further separate the odd divisors in two classes. If $d\equiv 1 \pmod{4}$, then the quantity $(d-1) /2$ is even and the sign appearing is $+1$.   If $d\equiv 3 \pmod{4}$, then the sign appearing is $-1$. On balance we will have
$$\sum_{ d \mid m  \text{ odd}} (-1) ^{\frac{d-1}{2}} = \sum_{ d \mid m  \ \ d \equiv 1 } (+1) + \sum_{ d \mid m  \ \ d \equiv 3 } (-1) = d_1(m) -d_3(m) $$
Plugging this into the original equation we get
$$\sum_m q^m \sum_{d \mid m \text{ odd}} (-1) ^{\frac{d-1}{2}} = \sum_m (d_1(m) -d_3(m)) q^m$$
As desired.
