"Thank you to the British people," he said. "Thank you for sharing your stories with me. I have learned so much from you. It has been an enormous privilege.
"Thank you for the support and thank you for the most unlikely cult of the 21st century - Milifandom."
He added that Labour must "rise to the challenge" of rebuilding the party and keeping the UK together.
He said: "To all the Labour Party members, you are the most loyal, supportive and amazing people. Your responsibility is to pick yourself up and continue the fight. We have come back before and this party will come back again.
"Conduct this leadership election with the same comradeship I believe this country should be run.
"Change happens because people don't give up. They keep demanding change."
Earlier, he had apologised for the poor performance in Scotland.
"I want to say to all the dedicated and decent colleagues in Scotland who have lost their seats that I am deeply sorry for what has happened.
"And I also want to say that the next Government has a huge responsibility. It has a huge responsibility in facing the very difficult task of keeping our country together," said Miliband.
"Whatever party we come from, if we believe in the United Kingdom we should stand up for people in every part of our United Kingdom because I believe that what unites us is much, much more than what divides us."
Attention within the party will now turn to finding a replacement. Miliband's shadow chancellor, Ed Balls, would have been among the favourites but lost his seat as an MP following a vote count which lasted nearly 12 hours.
Balls - who ran to be Labour leader after the last election in 2010 - was defeated by Conservative challenger Andrea Jenkyns by a margin of 422 votes in the Morley and Outwood constituency.
Bookmakers have placed Balls' wife, Yvette Cooper, as one of the favourites to lead the party.
Cooper, the shadow home secretary, who held on to her seat with a 55 per cent share of the vote, was careful to dodge questions about the leadership of the party, saying: "I really don't think we should be talking about this."
Bookmaker Ladbrokes, however, put her on 7/2, just behind Andy Burnham, the shadow health secretary, the overall favourite on 5/2.
Chuka Umunna, who is said to have the backing of Tony Blair to become the next party leader, was re-elected as the MP for Streatham, and is now on 3/1. William Hill make him the favourite with odds of 7/4.
- Telegraph Group Ltd, Daily Mail