Nobody writing mathematics types 2*x. They type 2x, and they expect the tool to understand. The
parser has to insert the multiplication signs that a human leaves out, which is easy in the common cases
and genuinely ambiguous in a few.
The easy cases
A number followed by a name, a name followed by a bracket, a bracket followed by a bracket: all
unambiguously products. 2x, 3(x+1) and (x+1)(x−1) need no thought.
The awkward one
sin(x)(x+1) is a product of a function value and a bracket. sin(x+1) is a function applied to a sum.
The difference is only in where the first bracket sits, so the tokenizer has to know which names are
functions before it can decide.
Why the preview exists
Because these decisions are guesses, the typeset preview under the input is not decoration. It is the parser showing you what it decided, in notation, before you commit to differentiating it.