Three Camps on One Question
Sunni Islam and its four schools of law, Hanafi, Hanbali, Maliki, and Shafii, hold the classical Sunni account: the caliph is chosen by those qualified to choose and receives the pledge of allegiance of the community, and the first four successors to Muhammad are held to have been rightly guided.
Twelver Shia Islam, the Jafari school, and Ismailism reject that account outright. Twelver teaching holds that authority passed by explicit designation to Ali and to the imams descended from him, so the elected caliphate of the early successors is refused rather than reinterpreted.
Four smaller bodies, Ahmadiyya, Ibadism, the Kharijites, and Zaidiyyah, hold neither camp's account, and not the same account as each other either. Ibadi teaching allows any qualified Muslim to serve as imam regardless of descent, and holds that a community may lawfully live with no imam at all. The Kharijite position was that any qualified Muslim may hold the office whatever his lineage, and that a ruler who sins gravely forfeits it. The Zaidi imamate belongs to a qualified descendant of the Prophet's grandsons who claims it openly and takes up arms for it, neither the Sunni election nor the Twelver designation. The Ahmadiyya caliphate, established in 1908, succeeds the movement's own founder and is elected by a council for life, a spiritual and administrative office with no territorial claim at all.