It’s helpful if we think about the sects as both religious and political, for these purposes.
Sharia law, like any, requires that there be ruling bodies sitting in judgment of legal violations. The split is between who the rightful rulers of the Islamic state are – the group now known as Sunnis chose Abu Bakr, the prophet’s adviser, to become the first successor, or caliph, to lead the Muslim state (therefore, choosing one who would most likely follow the traditions of Islam), and the Shiites favored Ali, Muhammad’s cousin and son-in-law (therefore, choosing a bloodline-based inherited rulership).
Ali and his successors are called imams, who not only lead the Shiites but are considered to be descendants of Muhammad. After the 11th imam died in 874, and his young son was said to have disappeared from the funeral, Shiites in particular came to see the child as a Messiah who had been hidden from the public by God.
So Sunni leadership is based on appointment (I would say like a democracy, but it is, of course, more like a dictatorship) and the Shiite is based on inheritance (a monarchy).