Hokage get decided by the hokage before him.
Hiruzen started looking for a successor
After serving as Hokage for many years, Hiruzen started looking for a successor to the title. While he hoped to be able to give the position to Orochimaru, he saw that he only was interested in the power it offered. Though he turned to Jiraiya, Hiruzen instead named Jiraiya's student Minato Namikaze as his successor.
As Jiraiya originaly chosen by the 3th hokage. and the fourth dying before being able to choose a new one, the village returned to Jiraiya whom once again turned down the offer an found a replacement for him instead in this case tsunade.
When Tsunade went in a coma there where no legendary sannin left to fill in this blank the village dident know what to do. And this is where Danzo stood up and offerd to be the 6th hokage which in these desperate times got approved.
my sources
jiraiya
hiruzen
danzo