There have been many articles (like this one) decrying or staring in dismay at the fact that the election for Prime Minister of the UK, the head of the country's government, is in the hands of the small and unrepresentative body of paid-up members of the Conservative Party.
This criticism would make sense if Prime Minister were an elected position like President of the US. But the Prime Minister is not a president, despite repeated observations over the last half-century about how much more presidential the post is becoming, and it is necessary to understand that in order to grasp what's actually going on here.
The President of the US isn't actually a directly-elected post either. What voters vote for is electors, the members of the Electoral College, and they are pledged to vote for a particular presidential candidate. That's relatively straightforward.
In the UK, what voters vote for is their local member of Parliament. Candidates for Parliament are normally pledged to support a particular political party, and it's that party which chooses its own leadership. If that party has the confidence of Parliament, i.e. enough votes to securely win divisions, then its leaders become the government and the principal leader Prime Minister. If the leader leaves mid-term, that's the party's business and not the electorate's. The electorate voted for the party.
Understand that and it should be clearer. Unfortunately, general discourse is against this. One reads regularly in, for instance the last general election, that voters voted for May or Corbyn. That they did not, unless they lived in Maidenhead or Islington and one of those worthies was their local MP. They voted for candidates who were pledged to support the Conservative or Labour Party - the party, not the leader - and May and Corbyn were the leaders of the parties and consequently the one whose party won would become PM.
Putting the choice of leader to the party members is actually far more democratic than in the past. When the post first emerged in the 18C, the prime minister was the servant of the monarch. The monarch could choose anyone he or she wanted, so long as that person could secure the passage of bills through Parliament, and bribery and patronage usually took care of that. By the mid-19C, with the development of meaningful constituency votes, it came to be recognized that the government should reflect the results of elections, and leaders were chosen by inner-circle jockeying among influential politicians over who could most effectively lead.
The Conservative Party continued to choose its leaders by this method as late as the succession of 1963, whose contentiousness led them to acknowledge this was out of date, and they changed to the same method used by the Labour Party. The Labour Party, which didn't date back to the 19C, originally held to the position that it didn't have a leader as older parties did. What it had was a body of MPs, and that body had a chairman, whose primary job was to preside at meetings. By that token it made sense for that body to elect its own chairman. When the Labour Party found itself obliged to form a government in 1924, it made sense for the chairman to take the government post of Prime Minister, and the party found itself assimilated. But the principle had been established that the MPs elect the leader because they know the people they'll have to work with, and after 1963 the Conservative Party joined them in this principle. It was on this basis, for instance, that Thatcher was deposed in 1990.
But, following the more participatory lead of the smaller Liberal Party, the larger parties eventually decided that the job of choosing the leader and potential PM was too big for the MPs, and (after much messing about, particularly in Labour) eventually decided that, while the MPs could nominate and winnow down candidates, final decision should go to the party members, which means mostly activists, many of them extreme. Going to a general electorate of party voters, as in US primaries, is not a step the UK is considering, and would probably not be workable there. And that is why, despite the alarm of almost everyone who isn't a blue-waving Tory, Boris Johnson looks about to become PM ...
Or is he? Because the PM is by definition the head of the government, and the government is a body which has the confidence of Parliament, and several Conservative MPs - including even the current Chancellor of the Exchequer - have said they would not vote for a Boris-led government. Tory rebels are traditionally more talk than action, but if they stick to their word, then Boris will not win confidence and will not become PM despite being party leader.
But then what happens? It's Boris's position on Brexit which has generated rebellion, but there is not a single position on Brexit which isn't unalterably opposed by a majority of MPs, so how could anyone win? It puts the Queen in a difficult position, because she has to commission the PM. The PM is still legally her servant, though nowadays she's obliged to follow whatever Parliament says. But what if Parliament - by not passing any votes, something it's already done more than once in respect of Brexit - doesn't say anything? It's a perilous world we live in.