The United States Constitution does not address political parties or the ways in which such parties should nominate presidents. Political parties did not seem to be on the minds of the Framers. Without official instruction, parties, as your question acknowledges, have used many methods to pick a candidate.
At first, a party would select a candidate through Congress. Each party in Congress had their caucus that would deliberate on which candidate they should pick.
As you might suspect, such a process attracted criticism. It didn’t give regular people that much of an input. More so, it upset the balance of powers that the Framers were adamant about. In 1812, Congress (i.e. the Legislative Branch) threatened to withhold James Madison’s nomination for a second term unless he declared war on England.
When the Federalist party folded, there was only one political party. This party has been called the Democratic-Republican party, the Jeffersonian Republican party, and quite a few other names. Anyway, with no other party to compete with, the one political party took a rather lax approach to the nominating process.
Their leniency led to an 1824 election in which no candidate won enough Electoral College votes to be declared President. The House of Representatives ended up choosing the President. They selected John Quincy Adams, even though Adams had fewer popular votes than Andrew Jackson.
The disordered 1824 campaign led to the two-party system and nominating conventions. Powerful people within the two parties picked delegates. These delegates would pick the candidates that the powerful people within the parties wanted.
As you might suspect, this process produced problems as well. Once again, the process pushed aside regular people. In 1912, Theodore Roosevelt won nine out of the ten Progressive party primaries. Yet party delegates chose William Howard Taft. The explicit disregard for the common voters helped draw attention to the rather undemocratic ways in which parties picked candidates.
Around five decades later, in 1968, Democratic candidate Hubert Humphrey ignored the primaries. He focused on delegates. Humphrey’s strategy—and his ensuing loss to the Republican candidate Richard Nixon—lead to more changes. Now, parties would select their candidates based on popular votes.
With that being said, there continues to be attempts to give delegates—and party higher-ups, by extension—more control.
In 2016, the Republican party tried to permit delegates to act against the primary votes in a bid to stop Donald Trump’s nomination.
More recently, this year, there was speculation that Democratic delegates would nominate someone else if Bernie Sanders won the most votes in the Democratic primaries.