Following an election or after the previous Prime Minister resigns, the Queen formally invites the selected individual to become Prime Minister. This invitation is known as the "kissing hands" ceremony. The new Prime Minister then proceeds to Buckingham Palace, the monarch's official residence in London, to meet with the Queen and accept the appointment.
During this meeting, the Queen formally asks the Prime Minister to form a government and appoints them to the position. Once appointed, the Prime Minister has the authority to exercise executive power and make decisions on behalf of the government.
It is important to note that the Queen's role in appointing the Prime Minister is largely a formality, as the actual choice of Prime Minister is based on the outcome of democratic elections and political conventions. The monarch's role in this process is mostly symbolic and constitutional.