We have a biased coin with probability of heads p. We win $1 if we predict the number of heads correctly. Otherwise, nothing.
How would one go to develop the optimal betting strategy to maximize expected earnings in a two coin toss game? That is, what is the number of heads we should predict in two coin tosses to maximize expected winnings?

For $2$ coins, the probability of 2 heads is $p^2$ and probability of 2 tails is $(1-p)^2$. The probability of exactly one heads is $2p(1-p)$. Based on the value of $p$, you should choose the number of predicted heads. In general, if $X$ is the number of heads in a sequence of $n$ tosses and $X_i$ is an IRV such that $X_i = 1$ if $i^{th}$ toss is heads and 0 otherwise, then
$$E(X) = np$$
This is the average number of heads you expect to see. For 2 coin toss, you should bet on seeing 1 head in 2 tosses if $p=1/2$. For $p=1$, you would bet on 2 heads.