I am asked to find the PMF of $X$, for the following definition of $X$:
"There are two coins, one with probability $p_1$ of Heads and the other with probability $p_2$ of Heads. One of the coins is randomly chosen (with equal probabilities for the two coins). It is then flipped $n \geq 2$ times. Let $X$ be the number of times it lands Heads."
My intuition is that to choose the coin at random, there is first a Bernoulli distribution $Y \sim \operatorname{Bern} \left({\frac{1}{2}}\right)$, which has a simple PMF, namely $P(Y=1)=P(Y=0)=\frac{1}{2}$. Then once the coin is chosen there is some binomial distribution $X \sim \operatorname{Bin} \left({n},p_i\right)$ where the PMF is $P_i(X=k)=\binom{n}{k}p_i^k(1-p_i)^{n-k}$ for $i=1,2$.
I am confused as to how to combine these two distributions/PMFs together into one. I am also wondering what the distribution of $X$ would be if $p_1=p_2$; would it just be another binomial distribution?