Summation of a product

I have basic doubt regarding summation over a product.

The starting equation is $\sum_{z}\prod_{k=1}^{K}\pi_k^{z_k}f(x|\mu_k)^{z_k}$ and it is given that $\sum_{k}{z_k}=1$

How does it become $\sum_{k=1}^{K}\pi_kf(x|\mu_k)$

-

You are probably talking about a mixture of Gaussians. Apart from $\sum_k z_k=1$, with an additional constraint that, each $z_k \in {0,1}$ (binary), you will have your result. Note that the two constraints imply that there is only one position out of $K$ in $\boldsymbol{z}=(z_1,\ldots,z_K)$ that is 1, the rest is 0.
To be precise, $\sum_z$ is sum of all possible $\boldsymbol{z}$ (i.e., 1 at each position). There are only $K$ possible $\boldsymbol{z}$, the sum can be written as $\sum_{k=1}^K$. The product over $K$ components, $\prod_{k=1}^K$ actually has only one multiplicand because the other $K-1$ multiplicands are raised to the power of 0.