The US's political system is basically set up in a way that prevents more than two political parties feasibly existing. Some states have decided to ameliorate the two-party situation by tweaking the primary system to act as a pretend first round of the election instead of making the actual election be two rounds or other alternatives to first-past-the-post elections. Such a primary is known as a "jungle primary."
Personally, I've only lived in states that have open primaries (anyone can participate in the primary), or semi-open primaries (independents voters can participate in any primary; declared voters must participate only in their own party's). I'd personally prefer a blanket primary (you can choose the primary to vote in on a per-party basis), but the Supreme Court ruled that it unconstitutionally violated the freedom of association in the First Amendment.
One thing to remember about US elections: there's not one set of rules that governs everything. There's generally at least 50 different sets of rules, one for each state; and even then, you can get different rules for different races. Generalization is therefore quite difficult for US elections.
In many jurisdictions can't vote in a party's primary unless you belong to that party.