Hi!
In a representative democracy, the people will vote for certain representatives which will then elect a prime minister.
So, in a way - the people are electing the prime minister. However, technically, it is the representatives doing such.
Hopefully, this helps! =)