Before the Carolingians, we see the Merovingian dynasty act as a precursor. Problem is, this dynasty was marred by the same problems which beset the Roman Empire plus some. For instance, its interiority was wrecked by warfare, Royal Minorities (kings under the age of twelve) who proved incapable of properly ruling, and sycophantic parasites who further weakened central power. At this time, the Carolingians are one faction vying for control in an otherwise politically fraught landscape.
Before Pippen the Second died, he left behind a notice naming an illegitimate grandchild as his successor. Obviously, this was not met with a lot of support and promoted rebellion against the Carolingian line. Charles Martell, another illegitimate son of the late ruler, took this opportunity to rally supporters around himself as a legitimate interim ruler until the baby ruler came of age. Though he had to fight a two-front war against loyalist and Frankish separatists, he prevailed. Once he was head-honcho, he would go on to launch a series of war of aggression against Frankish neighbors, eventually reclaiming and reintegrate South Frankia back into Christian hands after the Arabs are driven out.
Meanwhile, in the Byzantine Empire, there is a little something called the Iconoclast Controversy happening. You see, in response to yet another Arab attempt to conquer Constantinople, the Byzantine Emperor raised the taxes yet again. Since the papacy was expected to pay taxes, but really only decided to pay taxes and support the Byzantine involvement in Papacy elections out of a mutual alliance where Byzantine troops protected Papal property, this was expected to be a closed and shut case; unfortunately, because the Byzantines weren’t holding up their end of the bargain, the papacy stages a tax revolt, refusing to contribute to the tax hike. Needless to say, relations between Leo the Third (the Byzantine Emperor) and the Papacy grow tense. In 729 things get even worse when Leo the Third forbids the veneration of holy images in the Byzantine Empire—pictures of Jesus, and Mary (among others) are ordered destroyed in both private and public places. Leo sends a letter expecting the Pope to comply but, surprisingly, the Pope refuses; in retaliation, around 732 or 733, the Byzantine Emperor seizes all Papal property in Southern Italy and Sicily. In turn, around the middle of the eighth century, the Papacy stops notification of the imperial government of papal elections. It should be noted that this act is a political instead of a religious difference, as religious schism does not develop until the eleventh century.
So, you know have a political situation where you need protection from the barbarians. Where oh where is that protection going to come from, you ask as a papal leader. Well, the Carolingians might offer a hand… and so they do!
Charles Martel dies in 741 leaving behind two sons, one who retires to a monastery and another who is known as Pippen the Third. Once in power, Pippen manages to defeat rival claims to the throne and cement control over the empire. In 650, though, Pippen sends ambassadors to Rome, to the Pope. The end result of this is an alliance which, in part, gives the Carolingians the authority to depose the last of the Merovingian kings and cements Pippen as king in 754 when he is anointed as king by the pope. In 755-6, Pippen leads the Frankish army south of the Alps to attack the Lombards to hold-up his end of the agreement with the Pope, for the agreement to depose the Merovingian king did not come without any clauses.