Product of $n$ terms of sequence where the $n^{th}$ term is of the form $(x^{a^n}+1)$ While practicing from a book I found a product in the form $$(x^{a^1}+1)\cdot(x^{a^2}+1)\cdot(x^{a^3}+1)\cdot(x^{a^4}+1)$$ and was immediately curious if I could a formula to solve the product for $n$ terms, that is, a single formula for the product $$(x^{a^1}+1)\cdot(x^{a^2}+1)\cdot(x^{a^3}+1)(x^{a^4}+1)\ldots(x^{a^n}+1)$$
After multiplying the first four terms I could see a pattern develop in the form $x^{a+a^2+a^3+a^4...a^n}+x^a+x^{a^2}+x^{a^3}+x^{a^4}...+x^{a^n}+x^{a+a^2+a^3}+x^{a+a^2+a^4}+x^{a^2+a^3+a^4}+x^{a+a^3+a^4} ...+x^{a^{n-2}+a^{n-1}+a^n} + x^{a+a^2}
+x^{a+a^3}+x^{a+a^4}+x^{a^2+a^3}+x^{a^2+a^4}+x^{a^3+a^4}...x^{a^{n-1}+n}...+x^{a+a^2+a^3+....a^{n-2}+a^{n-1}+1}$
Now I can easily find the summation of powers in the first term but cant find a formula for the summation of $x^a+x^{a^2}+x^{a^3}+x^{a^4}...+x^{a^n}$ and also can't figure out how to account for the other terms.

Using $[n]=\{1,2,\ldots,n\}$ we can write the product as
\begin{align*}
\prod_{j=1}^n\left(x^{a^j}+1\right)=\sum_{S\subseteq [n]}x^{\sum_{j\in S}a^j}
\end{align*}
where $S$ runs over all subsets of $[n]$. A special case is $S=\emptyset$, which gives the empty sum. The empty sum is zero per definition, resulting in $x^0=1$.
