The last equality follows from the identities for the Rogers–Szegő polynomial \(H_n(t,q)\) :
\(H_n(t,q)=\sum _{j=0}^{n} t^j \begin{bmatrix} n\\ j\end{bmatrix} =\sum _{r=0}^{\lfloor n/2\rfloor } t^{2r} (-q/t;q^2)_r (-t;q^2)_{\lceil n/2 \rceil -r} \begin{bmatrix} \lfloor n/2 \rfloor \\ r \end{bmatrix}_{q^2}.\) 

See [1]}.
