The Prime Minister is not elected directly, he's simply the head of the party that got the most seats.
To clarify further, the prime minister can actually be any person at all (it's constitutionally questionable whether the prime minister even need be a Canadian citizen over 18 years of age). The Canadian system of government is very different from the American system, and few Canadians know how our system actually works (thanks to bombardment of American media and their electoral system).
The head of state is the Queen of Canada, Elizabeth II, who is also the Queen of England. Her duties are carried out by the Queen's representative in Canada, the Governor General (currently Michaëlle Jean), who is appointed by the Queen on the advice of the prime minister.
When elections are called in Canada (which happens every five years, or sooner if the government loses the confidence of the house), Canadians go to the polls and elect 308 representatives to the House of Commons -- one representative from each riding in the country, in a first-past-the-poll vote. While there are some independent members elected to the house, typically the members come from one of the four major political parties: the Conservatives (right-of-centre), the Liberals (central), the New Democratic Party (left-of-centre), or the Bloc Québécois (a Quebec-interest-only party). The Green Party (left-of-centre) has also nearly elected some members to the house, and briefly held a house seat after one member crossed the floor.
Once the 308 members have been elected to the house, the Governor General chooses someone to be the prime minister. That person will form a government by choosing people (here, I mean anyone he or she pleases from the general population) to be their ministers.
The newly formed government, with the prime minister chosen by the Governor General and ministers chosen by the prime minister, then faces a vote of confidence by the house. Here is where the elected representatives of Canada have their say: do they have confidence in the abilities of the newly formed government to lead the country? If they say no, the Governor General must either find a new prime minister and government that could hold the confidence of the house, or dissolve parliament and call a new election to find 308 new representatives.
So, in practice, in order to ensure that the chosen prime minister and government will have the confidence of the house, the Governor General will appoint the leader of the party with the most seats in parliament as the prime minister. But, with all that said, it's important to note that our system is very, very different from the American system in which a president is elected.