First comes the preparation of the public opinion — it is campaigning, political advertisement, debates, etc. This shapes the voting outcome.
At this stage it can be heavily influenced by foreign actors (adversaries), this is why in most countries there are laws regarding the transparency of political campaigns (funding, ads, and so on). You can't let China elect presidents in your country...
> doesn't change the fact that people did in fact vote for him
It also doesn't change the fact that if Russia didn't pour a lot of money into his campaign, he wouldn't have gotten any votes.