An identity for polynomials over partitions Given an integer partition $\lambda=(\lambda_1,\dots,\lambda_{\ell(\lambda)})$ of $n$ where $\ell(\lambda)$ is the length of $\lambda$, associate its conjugate partition $\lambda'$. Denote by $\lambda''=\lambda',0$ found by appending one extra zero at the right end of $\lambda'$. Further, define the following two numerics $a(\lambda'')_j=\lambda_j''-\lambda_{j+1}''$ for $j=1,2,\dots,\ell(\lambda')$ and also that 
$b(\lambda'')=\#\{j: a(\lambda'')_j>0\}$. 
For example, if $\lambda=(4,2,1)$ then $\lambda'=(3,2,1,1)$ and $\lambda''=(3,2,1,1,0)$ and $a(\lambda'')=(1,1,0,1)$ and $b(\lambda'')=3$.

QUESTION. If $n=2^m$ then are these two polynomials equal? 
  $$\sum_{\lambda\vdash n}(q-1)^{2b(\lambda'')}q^{n-\ell(\lambda)}
\prod_{a(\lambda'')_j\geq1}\frac{q^{2a(\lambda'')_j}-1}{q^2-1}=(q-1)(q^{2n-1}-1).\tag1$$

Remark 1. To get some motivation, consider dividing the left-hand side of (1) by $(q-1)^2$, for any $n\in\mathbb{N}$. Taking the limit $q\rightarrow1$ in the resulting expression forces $b(\lambda'')=1$ which means the corresponding Young diagram of the partition $\lambda'$ (hence $\lambda$ itself) must be rectangular. Therefore, the final expression equals the sum of divisors (arithmetic) function
$$\sum_{d\,\vert\, n}d.$$ 
Remark 2. I also observe that if $q\rightarrow-1$ in (1), then the left-hand side counts the number of ways of writing $n\in\mathbb{N}$ as a sum of two squares, which is this sequence $r_2(n)$. 
 A: Yes, your identity $(1)$ is true. We can give a proof as follows:
Let's denote the left hand side of your identity $(1)$ by $A_n(q)$. Starting with the identity
$$\prod_{i\geq 1}\left(1+\sum_{r\geq 1}a_r(x_1x_2\cdots x_i)^r\right)=\sum_{\lambda}\left(\prod_{j\geq 1}a_{\lambda_j-\lambda_{j+1}}\right)\left(\prod_{j\geq 1}x_j^{\lambda_j}\right)$$
where $a_0$ is taken to be $1$, and the $a_i, x_i$ are formal variables, we make the substitutions $a_r=(q-1)^2\frac{q^{2r}-1}{q^2-1}$ for $r\geq 1$, $x_1=t$ and $x_i=qt$ for $i\geq 2$. This turns the right hand side into a generating function for the $A_n(q)$ where $A_0(q)$ is taken to be $1$. More specifically it gives
$$\sum_{n\geq 0}A_n(q)t^n=\prod_{i\geq 1}\left(1+(q-1)^2\sum_{r\geq 1}\frac{q^{2r}-1}{q^2-1}(q^{i-1}t^i)^r\right)=\prod_{i\geq 1}\frac{(1-q^it^i)^2}{(1-q^{i-1}t^i)(1-q^{i+1}t^i)}$$
$$=(1-q)\frac{(qt;qt)^2_{\infty}}{(t;qt)_{\infty}(q;qt)_{\infty}}.$$
This final product has a Hecke-Rogers type expansion that was given by Andrews in "Hecke modular forms and the Kac-Peterson identities" (see Lemma 1).Using this expansion we get
$$\sum_{n\geq 0}A_n(q)t^n=(1-q)\sum_{N\in \mathbb Z, r\geq |N|}(-1)^{r+N}q^{-N}(qt)^{\frac{(r+N)(r-N+1)}{2}}$$
and if we focus on $n=2^m$ we notice that the only way we can have $(r+N)(r-N+1)=2^{m+1}$ is if $(r,N)=(2^m,2^m)$ or $(r,N)=(2^m, 1-2^m)$. This means that $$A_{2^m}(q)=(1-q)(1-q^{2^{m+1}-1})$$
as desired. The observations in the remark can also be deduced from this last summation.
