This is in the context of the expected value of a multinomial distribution in statistics, but I don't think that needs to be known for this specific question.
I'm confused about how an answer in my textbook simplifies the first equality into the second equality. It seems a bit out of the blue, and after some looking at, I don't know how the last equality was created.
Edit: n is a fixed positive integer.
If someone could help me out, that'd be much appreciated!

With compact notations
$$ \begin{cases}a&=&1-p_2-p_3-...-p_{k-1}\\b&=&n-x_2-...-x_{k-1}\end{cases},$$
your sum becomes
$$\sum_{x_1=0}^b x_1\binom{b}{x_1}\frac{a^{-x_1+b}p_1^{x_1}}{a^b}$$
$$=\sum_{x_1=0}^b x_1\binom{b}{x_1} \left(\frac{p_1}{a}\right)^{x_1}$$
where we recognize the mathematical expectation of a binomial law $Bin(b,\frac{p_1}{a})$ which is indeed
$$b \frac{p_1}{a} \tag{1}$$
as desired.
Remarks:
The fact that this conditional expectation (1) is proportional to the ratio of probability $p_1$ to the complementary probability $a=1-p_2-p_3- ... -p_{k-1}$ is quite normal...
A similar issue.