The same way we make sure that non-online votes aren't tampered with.
Audits (of the procedures, devices and people involved in the votes as well as the results) as well as impartial (or mutually hostile) observers as well as a legal framework for declaring the legitimacy of the result with provision for partial or full reruns on the election in cases of doubt.