Regarding the derivation on this page: http://lampx.tugraz.at/~hadley/ss2/fermigas/thermo/thermo.php
I'm stuck with the summation over macrostates {$q$} being the same as the sum over microstates {$n_i$}. I have [equation 3 in the above page] $$\mathcal{Z}=\sum_q \prod_i exp\big(-\beta n_{q,i}(\varepsilon_i-\mu)\big) $$ but I'm stuck on how this summation evaluates to [equation 5] $$\mathcal{Z}=\prod_i \bigg(1+exp(-\beta(\varepsilon_i-\mu))\bigg)$$
The mediary step they provide is replacing the macrostate sum with the microstate sum: $$\sum_q \rightarrow \sum_{n_1=0}^1\sum_{n_2=0}^1...\sum_{n_{q_{max}}=0}^1$$ so they have [equation 4] $$\mathcal{Z}=\sum_{n_1=0}^1 \sum_{n_2=0}^1...\sum_{n_{q_{max}}=0}^1 \prod_i exp\big(-\beta n_{q,i}(\varepsilon_i-\mu)\big)$$ but I haven't been able to manipulate or expand this to produce [equation 5] without having additional factors. I'm not sure if $n_{q,i}$ has a new meaning in the microstate sum (e.g. $n_{q,i}$ being different from $[n_{j}]_i$), if I'm mistaking the way $n_{q,i}$ is defined (I'm looking at it as though $q$ and $i$ are indices like that of a rank-2 tensor), if I'm making a mistake with evaluating the sums, or something I'm not thinking of, but I'm stuck. Could anyone explain how to get from [equation 3] to [equation 5]?