So, the way that I approached it was: the distribution of heads that Eflips will be given by $B(n, p_1$). This distribution also represents the number of trials that P will complete, and so if we let $x = B(n, p_1)$, then the distribution of the number of heads that Pete gets should be $B(x, p_2)$.
However, I'm not sure if this legal in the sense that $B(x, p_2)$ is really just $B( B(n, p_1), p_2)$, and I wasn't sure if you can have a binomial distribution as the number of trials you will perform.
The only other alternative I could think of was that we let $x = E[B(n, p_1)] = np_1$, so then the distribution of the number of heads that Pgets should be $B(x, p_2) = B(np_1, p_2)$. However, $np_1$ is really just the average amount of heads that we expect E to toss, and I'm not convinced this is what should be used to find what the distribution of the number of heads that Pete gets should be.
Any help on how to think about this problem would be greatly appreciated!
This is what we call a hierarchical model. The random number of heads that Emily gets is some binomial random variable, say $$X \sim \operatorname{Binomial}(n, p_1), \\ \Pr[X = x] = \binom{n}{x} p_1^x (1-p_1)^{n-x}, \quad x \in \{0, 1, 2, \ldots, n\}.$$ Then, conditioned on the number of heads Emily got, the number of heads Pete gets is also binomial, say $$Y \mid X \sim \operatorname{Binomial}(X, p_2), \\ \Pr[Y = y \mid X = x] = \binom{x}{y} p_2^y (1-p_2)^{x-y}, \quad y \in \{0, 1, 2, \ldots, x\}.$$ Note also that $\Pr[Y = 0 \mid X = 0] = 1$.
The question is asking you, what is the unconditional distribution of $Y$? In other words, if Emily and Pete were to perform this coin tossing experiment many, many times, what would be the long-term observed frequency distribution of the number of heads that Pete obtains? To calculate this, we would employ the law of total probability:
$$\Pr[Y = y] = \sum_{x=0}^n \Pr[Y = y \mid X = x]\Pr[X = x],$$ that is, the unconditional probability that Pete observes $y$ heads is the weighted average of the sum of all conditional probabilities of Pete observing $y$ heads given that Emily got $x$ heads, weighted by the probability that Emily got $x$ heads, and summed over $x = 0$ to $x = n$.
Now we have already stated the above probabilities in the above sum, so $$\Pr[Y = y] = \sum_{x=0}^n \binom{x}{y} p_2^y (1-p_2)^{x-y} \binom{n}{x} p_1^x (1-p_1)^{n-x}.$$
But we should also note that we can never have $Y > X$, because the number of heads that Pete gets is never more than the number of heads Emily got, since the latter is also the total number of trials that Pete conducts. So this sum is also $$\Pr[Y = y] = \sum_{x=y}^n \binom{x}{y} p_2^y (1-p_2)^{x-y} \binom{n}{x} p_1^x (1-p_1)^{n-x},$$ where we have changed the lower index of summation to $x = y$ because as we stated, $Y$ may never exceed $X$ (equivalently, $X$ is always at least $Y$). I leave the evaluation of this sum as an exercise.
For the sake of completeness, I should also point out that there is a less computational, combinatorial argument that can be employed. For instance, suppose that rather than having Pete flip his coin only as many times as Emily gets heads, he too flips his coin $n$ times irrespective of what Emily got. However, we pair up the results of each toss, so for example, we might get $$\{(H, H), (H, T), (T, H), (H, H), \ldots \}.$$ Then what we count for $Y$ is not the number of heads Pete gets, but instead, the number of times Pete and Emily got heads--i.e., we count only those outcomes that are $(H,H)$. Can you see how this is the same as $Y$? What is the probability distribution for the number of such outcomes?