Kenyatta gave a conciliatory message intended to help Kenyans accept the election outcome without violence: "This nation will have a president and that president will represent all Kenyans."
Results are not expected until Tuesday or Wednesday. A run-off between the top presidential contenders is likely in April, unless one unexpectedly captures more than 50 percent of ballots from among the pool of eight candidates.
Monday's separatist violence is different from the tribal, postelection violence experienced five years ago. The ethnic violence could still break out if Odinga or Kenyatta supporters feel their candidate was cheated out of a win.
In Kilifi, Nichodemus Shanga had hoped to vote at a primary school, but an MRC attack left several bodies lying on the ground, and he said officials didn't immediately remove them. Voting officials fled.
"I feel very bad because it is my right to vote. We came here at 5 a.m. asking them to remove the bodies so that we can vote, but they didn't do that and it has created a lot of tension and fear," he said, noting that residents fear a police backlash.
The chairman of the Independent Electoral and Boundaries Commission, Ahmed Issack Hassan, urged voters not to be intimidated by the violence. He also told poll workers they must ensure voters don't spend hours in line. Many polling stations were kept open after the 5 p.m. closing time to accommodate late starts and long lines.
The country's leaders have been working for months to reduce election-related tensions, but multiple factors make more postelection violence possible. The tribes of the top two presidential candidates have a long history of tense relations, and 47 new governor races are being held, increasing the chances of electoral problems at the local level.
One big electoral factor is that Kenyatta faces charges at the International Criminal Court for allegedly orchestrating Kenya's 2007-08 postelection violence. If he wins, the United States and Europe could scale back relations with Kenya, and Kenyatta may have to spend a significant portion of his presidency on trial at The Hague. Kenyatta's running mate, William Ruto, also faces charges at the ICC.
Pictures from across the country showed lines of voters snaking through fields, down streets and around corners.
Arthur Shakwira said he got in line at 4 a.m. in Kibera, Nairobi's largest slum, but left over confusion about which line to stand in. "We should prepare these voting areas sooner," Shakwira said. "Confusion. All the time it's confusion."
An election observer from a Ugandan group called the National Consultative Council, Christopher Kibanzanga, said he was impressed by the turnout.
"This can only be likened to South Africa when (President Nelson) Mandela was elected. The people have turned up in large numbers. The spirit of patriotism and nationalism has come back," Kibanzanga said.
Odinga's acrimonious loss to President Mwai Kibaki in 2007 triggered violence that ended only after the international community stepped in. Odinga was named prime minister in a coalition government led by Kibaki, with Kenyatta named deputy prime minister.
The Kenyatta-Odinga rivalry goes back decades. Kenyatta is an ethnic Kikuyu who is the son of Kenya's founding president. Odinga is an ethnic Luo whose father was the country's first vice president. Polls show the two in a close race, with support for each in the mid-40-percent range.
Most voters in Kibera —like Amos Achola, who said he arrived at the polling station at 2 a.m. — support Odinga.
"I think he wins but if he doesn't win I'll abide by the outcome," Achola said. "The other guy is also a Kenyan. If Kenyatta wins I'll accept it but I won't like. But I don't want violence."
Straziuso reported from Nairobi. Rodney Muhumuza contributed from Gatunda. Daud Yussuf contributed from Garissa.