Illegal voting had nothing to do with Trump's unprecedented loss of the popular vote.
The winner of the US presidential election must be elected by majority vote.
Of course, as long as we're hypothesizing the election to be by popular vote, we could make it by plutority too...
It's up to each state to choose their electors (plutority of popular vote, as you said being the most common, though not the only method).