How do you get a job as prime minister?

You are elected by parliament, or in rare cases, like the most recent one, the queen appoints you if someone resigns.