Election by shura was a method used only in the Rashidun Caliphate. The Ummayad and Abbasid Caliphates were hereditary systems, the Ummayad starting with a horizontal succession (brother to brother) before going vertically (father to son) and this was the system the Abbasids too used.
Now for the Rashidun Caliphs, there were 4: Abu Bakr al-Siddeeq, Umar ibn al-Khattab, Uthman ibn Affan, and Ali ibn abi Talib. The election of Abu Bakr came amongst the backdrop of the death of the Prophet Muhammad, and while the Muslim notables were gathered in Shura (council) trying to elect a new leader, Abu Bakr and Umar went to them. After a short discussion, Umar put Abu Bakr fowards and said he would pledge allegiance to Abu Bakr. The notables agreed and pledged their support, and it was decided amongst them that Abu Bakr would become Caliph. This established that there was no "mass vote" amongst the Muslim population, as it was the select few notables such as tribe leaders etc who voted. However some jurists went even more specific, saying that there only need be 5 electors to elect someone and make him a legitimate Caliph, as the notables who eventually agreed on Abu Bakr were first led by Umar himself, Abu Ubayda ibn al-Jarrah, Usayd ibn Hudayr, Bish ibn Sa'd, and Salim.
This view is also reinforced by the second Caliphs Umar own system of nomination for his successor: he chose a council of 6 from which there was to be a majority vote by them on their fellow peers to choose the next Caliph. Umar himself became Caliph because he was selected by Abu Bakr as his successor, also showing evidence that for a Caliph to choose his successor was not illegal under the Sharia.
Umars council of 6 which would elect the next Caliph, Uthman, included: Sa'd ibn abi Waqqas, Abd al-Rahman ibn Awf, Zubayr ibn Al-Awam, Talha bin Obaidullah, Ali ibn abi Talib, and Uthman. When Umar died, the first 4 stepped out of the "race", leaving the choice between Uthman and Ali, and Uthman was eventually elected with all members of that council giving him allegiance.
Ali was appointed by the majority of the people of Madina during turbulent times, and it was arguably forced on Ali who initially refused to be appointed Caliph after the murder of Uthman. While most of Madina, the capital of the Islamic State at the time, gave him allegiance, the family of Uthman, Bani Umaya (Ummayads) and some other notable Sahaba (companions of the Prophet) fled and essentially refused to pledge allegiance.
Anyhow, we see there was a different instance of election for each Caliph, stabilising into the heriditary succession used by the Ummayads and Abbasids from 661 CE-1517 CE.
To summarise;
Even within these instances, different interpretations were seen by some Jurists, e.g. through Ali's appointment, some Jurists say that the Caliph can be appointed by majority vote of the people, but this only applies to the Capital. But thats a different, longer story.