New York state voted yesterday, and both Clinton and Trump had resounding victories. As always, those on the losing side complained of "dirty tricks"
and "voter suppression". What happened is what is known as "the party system", which is what's supposed to happen during the primaries
. That is the function of the primaries, to allow the members of the parties to pick their candidate for the general election.
For better or worse, election law (other than campaign finance regulations) are left up to the states, so every state has it's own rules. Within the states, counties (or precincts) may have their own way of doing things. It's up to the campaigns to ensure that they know what those regulations are and comply with them, and ensure their supporters are doing the same. This is why it's advantageous for a candidate to belong to an established party - there is an infrastructure in place to make sure the "i's" are dotted and the "t's" are crossed - in every state, city, etc. It is difficult for new or independent candidates to run without this infrastructure, which is likely why Sanders decided to run as a Democrat, rather than try to create his own party.