As you might notice, in the last equation your integration variable is not $dZ$ but $dZ_j$. It should already give you an idea how the last equation appears. The variables $q_j$ represent distributions. In fact when you integrate the equation $\int\prod_iq_i\ln(q_j)dZ$, it is the same as integrating $\quad\quad\int q_j\ln(q_j)\prod_{i \neq j}q_i dZ_jdZ_{i \neq j}$ You are simply integrating the terms $\prod_{i \neq j}q_i$ out by marginalizing, since each $q_i$ is a distribution, which becomes one when integrated. Thus, you have $\quad\quad\int q_j\ln(q_j)\prod_{i \neq j}q_i dZ_jdZ_{i \neq j} = \int q_j\ln(q_j)dZ_j\int \prod_{i \neq j}q_i dZ_{i \neq j} = \int q_j\ln(q_j)dZ_j $ The term $\int \prod_{i \neq j}q_i dZ_{i \neq j}$ becomes one.