In this question we are asked to find the power series expansion of M(t) upto the t squared term. I understand how they've gone from step 1 to step 2, by dividing the top and bottom by p but I'm not able to understand at all how they have proceeded from step 2 to step three. Is there a general technique used to find the power series expansion for functions, how do we approach these types of questions from the start?
Any help would be much appreciated.

Note that we do not divide by $p$ but instead consider the reciprocal value and take from it the reciprocal again.
Now we use the binomial series expansion with $\alpha=-k$ \begin{align*} (1+z)^{-k}&=\sum_{n=0}^\infty\binom{-k}{n}z^k=1+\binom{-k}{1}t+\binom{-k}{2}z^2+\cdots\\ &=1-kz+\frac{1}{2}(-k)(-k-1)z^2+\cdots \end{align*}
Two aspects which should be considered:
Since each summand $\left(t+\frac{t^2}{2}+\cdots\right)$ starts with $t$ we do not need to consider higher powers than $2$ since then there is no longer any contribution to $t^2$ but only to higher powers of $t$.
It is this clever transformation right at the beginning which enables us to easily find the powers up to $t^2$. If we would instead start with a $k$-th power of a geometric series expansion \begin{align*} M(t)&=\left(\frac{p}{1-qe^t}\right)^k\\ &=\left(p\left(1+qe^t+q^2e^{2t}+\cdots\right)\right)^k\\ &=p^k\left(1+q(1+t+t^2/2+\cdots)+q^2(1+t+t^2/2+\cdots)^2+\cdots\right)^k \end{align*} each of the inner summands contributes to $1,t$ and $t^2$ and this is not easily manageable.