# Why does the second equality hold?

A sequence of n independent experiments is performed. Each experiment is a success with probability p and a failure with probability q = 1 - p. Show that conditional on the number of successes, all possibilities for the list of outcomes of the experiment are equally likely (of course, we only consider lists of outcomes where the number of successes is consistent with the information being conditioned on).

Why does the second inequality hold?

The second equality holds because $$k$$ is chosen so that $$\sum a_i = k$$. E.g. saying that $$X_1 = 1, X_2 = 0, X_3 = 1, X_1+X_2+X_3 = 2$$ is the same as saying that $$X_1 = 1, X_2 = 0, X_3 = 1$$, the last part is redundant information because on the event that $$X_1 = 1, X_2 = 0, X_3 = 1$$ we necessarily have $$X_1+X_2 + X_3 = 1+0+1 = 2$$. Do you see how this applies in general?
As for your main question, the issue with your reasoning is that you do not know (or have not stated why you know) that the $$\binom{n}{k}$$ paths that are possible are equally likely given the condition that the total number of heads is $$k$$. This follows from the independence of the $$X_i$$, which your reasoning did not mention, but which is used in the third equality.