Facing a problem in Katrin Becker, Melanie Becker, John Schwarz's String Theory In BBS's string theory book, in the equation (2.143), it says that $$\text{tr} \omega ^N=\prod _{n=1}^{\infty } \left(\prod _{i=1}^{24} \text{tr} \omega ^{\alpha _{-n}^i \:\alpha _n^i}\right)=\prod _{n=1}^{\infty } \frac{1}{\left(1-\omega ^n\right)^{24}}.$$ I agree with the first equality, but not the second. My calculation is as follows,
$$tr\omega^{N}=
\omega ^{\sum _{\phi } \langle \phi |N|\phi \rangle }=\omega ^{\sum _{\phi } \langle \phi |\sum_{n,i}\:\alpha_{-n}^i\;\alpha_{n}^i\;|\phi \rangle }=\omega ^{\sum_{n,i}\sum _{\phi } \langle \phi |\:\alpha_{-n}^i\;\alpha_{n}^i\;|\phi \rangle }=\prod _{n=1}^{\infty } \left(\prod _{i=1}^{24} \text{tr} \omega ^{\alpha _{-n}^i \:\alpha _n^i}\right),$$ my problem is that $$|\phi\rangle$$ is  the basis of the whole Hilbert space, not the Hilbert space created by acting a specific creating operator $$\alpha_{-n}^i,$$ so $$ tr\omega^{\alpha_{-n}^i\;\alpha_{n}^i}\neq\sum_{i=0}^{\infty}\omega^{\;i\;n}=\frac{1}{1-\omega^{n}},$$instead I think that $$tr\omega^{\alpha_{-n}^i\;\alpha_{n}^i}=\sum_{i=0}^{\infty}\omega^{\;i\;m\;n}=\frac{1}{1-\omega^{m\;n}},$$where m is some infinity large constant. 
I can not find the problem in my calculation, so can some one point out my mistake? And show me how to organize the Hilbert space to get BBS's conclusion.
 A: BBS omit to indicate which space they are tracing over in each step. Let me instead sketch why tracing over only the states created by the $\alpha_{-n}$'s in the last step is the correct thing to do. For simplicity I'll just do the $D=1$ case. 
First an important lemma says that if our Hilbert space is of the form $V = V_1 \otimes V_2$ and we have an operator $A_1 $ which acts on $V$ by acting via some well defined action on $V_1$ trivially on $V_2$ and vice versa for an operator $A_2$, then we have $$\text{tr}_V(A_1 A_2) = \text{tr}_{V_1}A_1 \text{tr}_{V_2}A_2.$$ This is easy enough to show and I encourage you to prove it. Now we must apply this carefully to the present case. For the case of closed strings our Hilbert space is the following:
Since the Hamiltonian takes the following form $$H = \frac{1}{2}p_0^2 + \sum_{n=1}^{\infty} \alpha_{-n}\alpha_{n} + \widetilde{\alpha}_{-n}\widetilde{\alpha}_{n} -\frac{1}{12}  = (L_{0} - \frac{1}{24}) + (\tilde{L}_0 - \frac{1}{24}) $$
our Hilbert space takes the form $$\mathcal{H} = \mathcal{H}_{\text{free}} \bigotimes (\otimes_{n=1}^{\infty}\mathcal{H_n}) \bigotimes (\otimes_{n=1}^{\infty}\widetilde{\mathcal{H}}_n) .$$ Here $\mathcal{H}_{\text{free}}$ corresponds to the free particle space which is due to the presence of the ${p_0}^2$, $\mathcal{H}_n$ is the space isomorphic to the one-oscillator Hilbert space created by $\alpha_{-n}$ and similarly for $\widetilde{\mathcal{H}}_n$. The partition function, which allows you to calculate how many states there are of a given energy is then computed by the following trace $$Z(q,\bar{q}) = \text{tr}_{\mathcal{H}}(q^{L_0 - 1/24} \bar{q}^{\tilde{L}_0 - 1/24}).$$
Now noting that $q^{\alpha_{-n} \alpha_n}$ acts non-trivially only on $\mathcal{\mathcal{H}_n}$ we can apply (a generalization of) the above Lemma to write $$Z(q,\bar{q}) = q\bar{q}^{-1/24} \text{tr}_{\mathcal{H}_{\text{free}}}(q\bar{q}^{p_{0}^2/4})\prod_{n=1}^{\infty}\text{tr}_{\mathcal{H}_n}(q^{\alpha_{-n}\alpha_{n}}) \prod_{n=1}^{\infty}\text{tr}_{\widetilde{\mathcal{H}}_n}(\bar{q}^{\widetilde{\alpha}_{-n} \widetilde{\alpha}_n}).$$ Finally, it's easy to see that $$\text{tr}_{\mathcal{H}_n}(q^{\alpha_{-n}\alpha_{n}}) = \frac{1}{1-q^{n}}.$$
