Because the reminder of division any number by 3 is 0, 1 or 2. so $\displaystyle n$ is $\displaystyle 3k+0$ or $\displaystyle 3k+1$ or $\displaystyle 3k+2$
Follows from the division algorithm (using an integer and 3). For each integer $\displaystyle a$, there exists unique integers $\displaystyle k$ and $\displaystyle r$ such that
$\displaystyle a=3k+r$, where $\displaystyle 0 \le r <3$.