Some analogs of the pentagonal number theorem There are the following analogs of the famous identity
$$
\prod_{n\geqslant1}(1-q^n)=\sum_{n\in\mathbb Z}(-1)^nq^{\frac{3n^2-n}2}.
$$
Let $v_2(n)$ denote the 2-adic valuation of $n$, that is, the number determined by $n=2^{v_2(n)}(2k+1)$. Then
\begin{align*}
\prod_{n\geqslant1}(1+q^n)^{1-v_2(n)}&=\sum_{n\geqslant1}q^{\frac{n^2-n}2},\\
\prod_{n\geqslant1}(1+q^n)^{-v_2(n)}&=\sum_{n\in\mathbb Z}(-1)^nq^{3n^2-n},\\
\prod_{n\geqslant1}(1+q^n)^{-1-v_2(n)}&=\sum_{n\in\mathbb Z}(-1)^nq^{\frac{3n^2-n}2},\\
\prod_{n\geqslant1}(1+q^n)^{-2-v_2(n)}&=\sum_{n\in\mathbb Z}(-1)^nq^{n^2}.
\end{align*}
I am not so much interested in proofs - I have almost finished proofs, but they are ad hoc and different in each of the cases. What I want to know is whether there is a general explanation for such identities, and whether there are more identities of this kind.
 A: Let $q_n = \exp\frac{2\pi\mathrm{i}\tau}{n}$ and $q=q_1$,
so we can regard expressions with $q$ as functions of $\tau\in\mathbb{H}$.
This is only needed to draw a connection to the Dedekind eta function $\eta(\tau)$.
It is not needed when focussing on formal $q$-power series only.
The following proof is based on binary representation of nonnegative integers,
which gives rise to the factorization
$$\frac{1}{1-q} = \sum_{m=0}^\infty q^m
= \prod_{k=0}^\infty\left(1+q^{2^k}\right)$$
and consequently
$$\begin{align}
\sum_{n\in\mathbb Z}(-1)^n q^{n(3n-1)/2} =
q_{24}^{-1}\eta(\tau) &= \prod_{n=1}^\infty(1-q^n)
= \prod_{j=1}^\infty\prod_{m=0}^\infty\left(1-q^{2^m(2j-1)}\right) \\
&= \prod_{j=1}^\infty\prod_{m=0}^\infty\prod_{k=0}^\infty
\left(1+q^{2^{k+m}(2j-1)}\right)^{-1} \\
&= \prod_{n=1}^\infty(1+q^{n})^{-1-\nu_2(n)}
\end{align}$$
The other identities follow from
$$q_{24}^{-1}\frac{\eta(2\tau)}{\eta(\tau)}
= \prod_{n=1}^\infty\frac{1-q^{2n}}{1-q^n} = \prod_{n=1}^\infty(1+q^n)$$
and from the known corollaries of Jacobi's triple
product identity:
$$\begin{align}
\sum_{n=1}^\infty q^{n(n-1)/2} =
\frac{1}{2}q_8^{-1}\Theta_{10}(0;\tau)
&= q_8^{-1}\frac{\eta^2(2\tau)}{\eta(\tau)} \\
\sum_{n\in\mathbb{Z}}(-1)^n q^{n^2} =
\Theta_{01}(0;2\tau) &= \frac{\eta^2(\tau)}{\eta(2\tau)}
\end{align}$$
Another corollary covers partition numbers $P(n)$:
$$\sum_{n=0}^\infty P(n)\,q^n = \prod_{n=1}^\infty\frac{1}{1-q^n}
= \frac{q_{24}}{\eta(\tau)} = \prod_{n=1}^\infty(1+q^{n})^{1+\nu_2(n)}$$
Here is another twist, using base-$3$ representations of natural numbers:
$$\begin{align}
\frac{1}{1-q} &= \sum_{m=0}^\infty q^m
= \prod_{k=0}^\infty\left(1+q^{3^k}+q^{2\cdot3^k}\right)
= \prod_{k=0}^\infty
\left(1-\zeta_3 q^{3^k}\right)\left(1-\zeta_3^{-1}q^{3^k}\right) \\
\quad\text{where}\quad \zeta_n &= \exp\frac{2\pi\mathrm{i}}{n} \\
\therefore\quad
q_{24}^{-1}\eta(\tau) &= \prod_{n=1}^\infty(1-q^n)
= \prod_{j=0}^\infty\prod_{m=0}^\infty
\left(1-q^{3^m(3j+1)}\right)\left(1-q^{3^m(3j+2)}\right) \\
&= \prod_{j=0}^\infty\prod_{m=0}^\infty\prod_{k=0}^\infty
\left(1+q^{3^{k+m}(3j+1)}+q^{2\cdot3^{k+m}(3j+1)}\right)^{-1}
\left(1+q^{3^{k+m}(3j+2)}+q^{2\cdot3^{k+m}(3j+2)}\right)^{-1} \\
&= \prod_{n=1}^\infty\left(1+q^n+q^{2n}\right)^{-1-\nu_3(n)}
= \prod_{n=1}^\infty
\left((1-\zeta_3 q^n)(1-\zeta_3^{-1}q^n)\right)^{-1-\nu_3(n)}
\end{align}$$
