Answering a question like this comes down to remembering the definition of what you're trying to prove, and then showing that the definition holds.
In this case, we'd like to show that "If either a or b is divisible by n then ab is divisible by n". The definition of divisibility is as follows:
We say that a number $m$ is divisible by $n$ if there exists an integer $q$ such that $m = qn$
Now, suppose that either $a$ or $b$ is divisible by $n$.
If $a$ is divisible by $n$, then $a=qn$ for some integer $q$, which means that
$$
ab=(qn)b=(qb)n
$$
which means that $ab$ is divisible by $n$.
Similarly, if $b$ is divisible by $n$, then $b=qn$ for some integer $q$, which means that
$$
ab = a(qn)=(qa)n
$$
which means that $ab$ is divisible by $n$. Thus, our proof is complete.
In practice, the part of the proof starting with "Similarly..." would be abbreviated by saying something like the following:
If $b$ is divisible by $n$, then $ab=ba$, and by the previous argument, $ba$ is divisible by $n$. Thus, $ab$ is divisible by $n$.
OR
If $b$ is divisible by $n$, then we can simply switch the labels $a$ and $b$ to find that, by the above argument, $ab$ is divisible by $n$
OR
If $b$ is divisible by $n$, then by symmetry, we conclude $ab$ is divisible by $n$.
This is a nice way to avoid having to go through the same sequence of steps multiple times.