What will be the remainder when $2^{31}$ is divided by $5$? The question is given in the title:

Find the remainder when $2^{31}$ is divided by $5$.

My friend explained me this way:

$2^2$ gives $-1$ remainder.
So, any power of $2^2$ will give $-1$ remainder.
So, $2^{30}$ gives $-1$ remainder.
So, $2^{30}\times 2$ or $2^{31}$ gives $3$ remainder.

Now, I cannot understand how he said the last line. So, please explain this line.
Also, how can I do this using modular congruency?

The salient feature here is that when taking the remainder of a product modulo some integer, it doesn't matter if you first take the remainder or first compute the product. In other words:
$$ab = (a \bmod n)(b \bmod n) \bmod n$$
Thus $2^{30} \times 2 =(2^{30} \bmod 5)(2\bmod 5) = ((-1)^{15} \bmod 5)2 = -2 = 3 \bmod 5$
