Kenya has held one of its most nail-biting and controversial elections since one-party rule ended in 1991, as candidates vied for a plethora of seats. Here, we look at some of those who succeeded, and some who failed, in their quest for power.
1) The unluckiest candidate
Raila Odinga, 77, is the most unfortunate presidential contender Kenya has ever had. He has run for the presidency five times and lost on each occasion, saying that the elections were stolen from him.
Kenya's highest court vindicated him after the last election in 2017 when it annulled President Uhuru Kenyatta's victory and ordered that the election be held again.
Mr Odinga boycotted the re-run, saying the groundwork had not been done for a free and fair poll.
He looks set to go to court again after rejecting Deputy President William Ruto's victory in the 9 August election by the narrow margin of 50.5% to 48.8%.
Raila Odinga, flanked by his running-mate Martha Karua, has vowed to challenge the result in court
Mr Odinga's case is bolstered by the fact that four of the seven electoral commissioners - including vice-chairperson Juliana Cherera - took the extraordinary step of rejecting the result.
Ms Cherera said that it was full of "mathematical absurdity that defies logic", and if one added the percentages - as announced by the commission's chairperson Wafula Chebukati - the sum came to 100.01%.
But some commentators have said that this is down to a simple rounding error - and have expressed confidence in the result announced by Mr Chebukati.
For the first time ever, the commission, in the interest of transparency, allowed media houses and civil society groups to tally official votes. Results from polling stations were uploaded on the commission's website for everyone to tabulate.
Significantly, the Elections Observation Group (Elog), which is made up of civil society organisations, have backed Mr Chebukati, saying that their tally matched the final results and that the "results transmission system worked better than expected".
But if he takes the legal route, will Mr Odinga be lucky a second time in court or will he be on the losing side? We will know once the Supreme Court hears the case, and makes its ruling.
For now, Mr Ruto - who won at his first stab at the presidency - is regarded as the president-elect, though the transition from the presidency of Uhuru Kenyatta may be delayed if a court needs to make a ruling.
During the campaign, Mr Kenyatta branded Mr Ruto "untrustworthy" of high office and campaigned for Mr Odinga to succeed him.
Mr Kenyatta has been silent since the result was announced, while a transitional committee - responsible for a handover - gave its first public briefing three days before the final results were announced.
It said it would start the process of ensuring a smooth transfer of power once the winner was declared by the commission, but it has not commented since the dispute broke out.
The president and his deputy are the most powerful men in Kenyan politics, but their relationship has been marred by tensions since Mr Kenyatta reconciled with Mr Odinga in 2018.
Many Kenyans are hoping that the two will now work together - rather than inflame tensions - if the electoral dispute makes its way through the courts.
For Mr Odinga's supporters, the result is deeply disappointingly as he is widely acknowledged as Kenya's "Father of Democracy", having been at the forefront of the campaign to achieve multiparty democracy, only for the presidency to elude him up to now.
2) The history-making women
Female representation in Kenya's counties has received a boost, with the highest number of women - seven - ever elected to the powerful post of governor. This is in contrast to the three who were elected in 2017.
Governors are in charge of huge budgets, and are expected to spearhead development in their counties.
The women defied sexism, bullying, and xenophobic slurs over their marriages to win.
They included Wavinya Ndeti, who becomes the first female governor of Machakos county after defeating three male candidates.
Ms Ndeti was married to a Nigerian-British national - the late Dolamu Henry Oduwole, who she met while studying in London.
Critics labelled her an outsider because of her marriage to a foreigner but she insisted that she was a "daughter of Machakos".
But the woman who has caught the attention of most Kenyans is Linet Chepkorir.
Aged 24, she will become the youngest woman to ever serve in the main parliamentary chamber, the National Assembly, following her election as woman representative for Bomet county.
Describing herself as coming from a "humble background", Ms Chepkorir told the BBC that this will be her first job.
"I just want to encourage the younger generation that everything is possible," she said.
It is still unclear whether female representation in parliament has increased, as the electoral commission has not yet released a full list of winning MPs.
What we do know is that Kenyans failed to elect their first-ever female deputy president, following the defeat - albeit in disputed elections - of Mr Odinga and his running-mate, former Justice Minister Martha Karua.
She was poised and dignified during the election campaign, rarely landing blows against her opponents, but she failed to rally a significant number of voters to cast their ballots for Mr Odinga.
Mr Ruto trounced Mr Odinga even in her constituency, prompting some social media users to direct sexist remarks at her.
"She represents only her dresses," one said.
The comment showed that despite the advancement of women's rights in Kenya, the nation still has a long way to go in defeating sexism.
3) Ganja man and reverend flop
A former street child who became a law professor, George Wajackoyah was the most eccentric presidential candidate. He trended on social media and drew huge crowds - especially of young people - at campaign rallies, with his promise to boost Kenya's floundering economy by turning the country into a major producer and exporter of marijuana, snake venom and hyenas' testicles.
At one point, pollsters had predicted that he would garner 5% of the vote, but he got a mere 0.44% in the election.
Faring worse than him was a lawyer and reverend, David Waihiga, who got 0.23%.
His poor showing came as no surprise. He campaigned on a promise to fight corruption but he failed to make an impact with Kenyans.
With the two not even getting 1% of the vote between, it is clear that when the crunch came, Kenyans stuck with the two big political beasts - Mr Ruto and Mr Odinga. They knew that if they voted for a minor presidential candidate, it increased the chances of a run-off, something they wanted to avoid.
4) Toilet cleaning candidate loses
Another politician who entertained Kenyans during the campaign with his antics was Polycarp Igathe, who ran for the prestigious post of governor of Nairobi.
He mopped a public toilet, washed cars, deejayed and served customers in bars, all the while trying to convince voters that he was ready to serve them in high office.
But he lost to Johnson Sakaja, who was not shy of gimmicks either, sharing photos of himself buying fish from roadside vendors, and tomatoes and onions from the market rather than supermarket. Mr Sakaja was the senator for Nairobi before his elevation to the post of governor.
Also rewarded with a win was Kimilili MP Didmus Barasa, who used a three-stone traditional fireplace to make tea for a 67-year-old widow, albeit still wearing his fancy leather shoes, while campaigning.
Mr Barasa, whose Kimilili constituency is in western Kenya, is currently being detained by police pending investigations over the alleged shooting and murder of his opponent's aide after a scuffle at a polling station on election day.
The MP, while surrendering to police, said he too wanted to know what had happened to the young man who was murdered.
Former senator Boni Khalwale also won in his bid to be re-elected as a senator for Kakamega county in western Kenya.
On the campaign trail, he opted for a roadside polish of his shoes, and ate roasted maize while waiting for them to be cleaned.
Now, Kenyans are waiting to see whether he, and the other winners, will forget their struggling constituents - or serve them diligently.