I'll add to the links. The prime minister is not directly elected for that position in the UK. He or she is elected to his or her seat and then becomes the prime minister (this is really simplified) if they are party leader and his or her party is the majority. Churchill was reelected in 1945, but his party was not the majority. This meant that he served as the leader of the opposition.
Essentially, Churchill lost his position because his party lost its majority, not because he was voted out or people necessarily disapproved of his leadership.
After WWI there was a serious concern in Britain that the government had failed to create a "Land fit for heroes". Unemployment and de-industrialisation in the 1930s had caused hardship for large proportions of Britain especially in the North.
After the war in both global and domestic politics there was a desire to do things differently and avoid the mistakes of the aftermath of WWI, Clement Attlee led the Labour party in the election stating he would create a welfare state to care for people from "the cradle to the grave", in practice establishing NHS (National Health Service), Pensions, Compulsory Secondary Education etc...
In 1942 the government had commissioned the Beveridge Report which identified five evils: want, ignorance, disease, squalor and idleness. The report recomended the establishment of serval new institutions and schemes to deal with this. In 1945 Labour were committed to putting this report into action.
By contrast Churchill made no such promises in his election campaign, he was popular in Britain at the time but had no plan for welfare reform.
The idea of a "welfare state" was not new in Britain and questions of how to deal with poverty in Britain had been a contentious political issue since the late 19th Century.
In short Churchill was a strong wartime leader but after the war public mood was shifting and the desire for wealfare and rebuilding was strong, Labour were better able to judge this change in mood and were more committed to post-war domestic reform.
Sources:
http://www.nationalarchives.gov.uk/cabinetpapers/themes/beveridge-bevan.htm
https://www.gov.uk/government/history/past-prime-ministers/clement-attlee
'Before Beveridge: Welfare Before the Welfare State' - D. Gladstone (1999)
Useful Videos:
Sir William Beveridge Talks To Pathe Gazette (1942)- Beveridge detailing his report in a newsreel. http://www.youtube.com/watch?v=l2DhvTCuK_s
Nye Bevan Speech (1946)- Bevan (The Health Minister) talks about rebuilding the nation http://www.youtube.com/watch?v=03IlA4xoAVw