The decision will allow Senator Robert Menendez, a Democrat from New Jersey, to run for re-election without having to face a new trial.