Some states caucus rather than primary. The delegates to the convention take the advice of the results but can opt to put their votes behind a different candidate if they choose. Not every party even hold primaries. Only the two largest because it's easier to make a good call