The product
$\,(-a)b\,$
can be written in a variety of ways:
$$
\overset{\cssId{s9}{\text{the opposite of $\,a\,$, times $\,b\,$}}}{\overbrace{\cssId{s8}{(-a)b}}}
=
\overset{\cssId{s11}{\text{$a\,$, times the opposite of $\,b$}}}{\overbrace{\cssId{s10}{a(-b)}}}
=
\overset{\cssId{s13}{\text{the opposite of $\,ab$}}}{\overbrace{\cssId{s12}{-ab}}}
$$
In all these cases,
the same three numbers are being multiplied
($\,-1\,$, $\,a\,$, and $\,b\,$),
so the result is the same.
People have different preferences as to how much or how little they use parentheses,
and how much or how little they use the centered dot to denote multiplication.
There are places where parentheses and centered dots are needed,
but in other situations they're optional.
I suppose that you might see any of these: $$ \cssId{s23}{ab} \ \cssId{s24}{=\ (a)b} \ \cssId{s25}{=\ a(b)} \ \cssId{s26}{=\ (a)(b)} \ \cssId{s27}{=\ a\cdot b} \ \cssId{s28}{=\ a\cdot(b)} \ \cssId{s29}{=\ (a)\cdot b} \ \cssId{s30}{=\ (a)\cdot (b)} $$ In this case, the simplest (and strongly preferred) representation is just $\,ab\,$.
When two variables are juxtaposed
(i.e., sitting next to each other),
as in the expression $\,ab\,$,
the operation between them is multiplication.
Thus, $\,ab\,$ is the simplest (and preferred) way to denote $\,a\,$
multiplied by $\,b\,$.
When a signed variable is involved, parentheses are usually required.
To multiply $\,a\,$ by $\,-b\,$ (in that order)
we can't just juxtapose them and write $\,a -b\,$,
because this would look like subtraction.
Thus, we must write $\,a(-b)\,$.
When you see opposites in multiplication problems,
just treat the minus sign as a factor of $\,-1\,$, and recall these rules:
Any even number of factors of $\,-1\,$ is positive:
for example, $\,(-1)(-1)(-1)(-1) = 1\,$.
Any odd number of factors of $\,-1\,$ is negative:
for example, $\,(-1)(-1)(-1) = -1\,$.
Conventionally, the minus sign (if there is one) is pulled to the front of the expression,
as illustrated in these examples:
$\,(-a)(-b) = ab\,$ | (two factors of $\,-1\,$) |
$\,-(-a)(b) = ab\,$ | (two factors of $\,-1\,$) |
$\,-a(-b) = ab\,$ | (two factors of $\,-1\,$) |
$\,-(-a)(-b) = -ab\,$ | (three factors of $\,-1\,$) |
$\,(-a)(-b)(-c)(d) = -abcd\,$ | (three factors of $\,-1\,$) |