The Catholic Church was the supreme power during the Medieval period. Everyone, kings, nobles and peasants all obeyed (mostly) whatever the pope said. However, Kings and Nobles also wanted power. The struggles between the church, the Kings and the other Nobles caused strife and hardships everywhere.
Charlemagne, king of the Franks, and Pope Adrian, head of the Catholic Church, both saw how this constant power struggle was causing turmoil and conflict throughout Europe. Both wanted it to end, so both went about doing what they could to end the strife. Charlemagne and Pope Adrian knew each other. They were very good friends. They knew that they would have to work together to unite Europe.
Did they sit down and plan how they would do this? We will never know since there is no record of their getting together to set up any such plan, but the results show that they did work together for the time that Charlemagne was King, and Adrian was pope. For a period of about 25 years they worked together and ended up ruling most of medieval Europe.
What did they do? Well Adrian as pope instructed all the priests and other Catholics to obey Charlemagne in all things secular. That means in what you do every day such as who pays what taxes, following the law, and going about your daily life. Charlemagne instructed the people to listen to the pope and the other priests about everything spiritual, such as how do you live a good life, how do get to heaven, etc.
With the Catholic church and Charlemagne working together by 800 CE almost all of Western Europe had become part of Charlemagne's kingdom, and most of the people had joined the Catholic church. This gave Europe a common culture.