Addressing the question in bold.
Here $x$ is a non-zero element of the ring $\mathbb{Z}_m$, where $m$ is a prime number. By Little Fermat we have $ x^{m-1}\equiv 1\pmod m. $ If we have the congruence $n\equiv k\pmod{m-1}$, this means that $n=k+q\cdot(m-1)$ for some integer $q$. Then we have $ x^n=x^{k+q\cdot(m-1)}=x^k\cdot x^{q(m-1)}=x^k\cdot(x^{m-1})^q\equiv x^k\cdot 1^q=x^k\pmod{m}, $ where in the next to last step we used Little Fermat.
My original answer below
Let's check the steps on that line of congruences one at a time. The first congruence claims $ M^n\equiv M^{k\cdot(p-1)+1}. $ This follows from the fact that $n=k\cdot(p-1)+1$. Whenever raising objects to an integer power makes sense, we have the rule: if $a=b$, then $M^a=M^b$. This step is an application of that rule.
On to the second congruence $ M^{k\cdot(p-1)+1}\equiv (M^{p-1})^k\cdot M^1. $ This is an application of the hopefully familiar rules of exponentiation: $ x^{a+b}=x^a\cdot x^b $ and $ (x^m)^n=x^{mn}. $ Let's work our way from right to left. There the factor $(M^{p-1})^k$ equals $M^{k\cdot(p-1)}$ by an application of the latter rule: $x=M$, $m=p-1$, $n=k$. Then we also apply the former rule with $x=M$, $a=k\cdot(p-1)$, $b=1$. The rule $M^1=M$ is also used.
The next congruence states that $ (M^{p-1})^k\cdot M\equiv 1^k \cdot M. $ This follows from the principle that if $x=y$, then $x^k=y^k$. Here $x=M^{p-1}$. By Little Fermat that is congruent to 1, so $y=1$. The claimed congruence is gotten from this by multiplying both sides with $M$.
The last congruence states that $ 1^k M\equiv M. $ Well, we always have $1^a=1$ and we also have $1\cdot M=M$, so this is easy.
So this is just a chain of equalities. If you have not seen these before, you may find it a bit confusing that a congruence really is an equality. It becomes a second nature after you familiarize youself with the ring of residue classes modulo $p$. Plenty of resources in the textbooks (as well as in the web) will get you started with congruences.