The Emperor Charles V ruled not only the Holy Roman Empire, but the Netherlands, Luxembourg, Spain and parts of Italy, as well as possessions in the New World. Most of these lands he had inherited through hereditery right (being a member of the illustrious and powerful House of Habsburg), but the title of Holy Roman Emperor he had to gain by election. While his ancestors had monopolised this position since 1438 when Albert II had held the title, his predecessor Maximilian I had failed to ensure the succession of his grandson.
Charles managed to ensure the title for himself by bribing the electors, confounding the efforts of both Henry VIII of England and Francis I of France. As Holy Roman Emperor he was the King of Germany and the ruler of secular Christendom, who ruled it in conjunction with the Pope.
The political situation in Germany
Germany was made up of 300 seperate states - some fairly large, such as Saxony, others just comprising of a single city. Although the Emperor was the final judge of law in Germany and able to set the agenda for the German parliament (Diet), there were no institutions that stretched across the Empire as a whole. There was no "Imperial army", no Imperial system of taxation. The Diet met infrequently and Charles was forced to resort to dealing with matters with individual Princes. The Princes were quite powerful, controlling matters of justice within their own lands and bestowing patronage on lesser nobles.
Maximilian's answer to the problem of weak central authority in Germany had been to split it into smaller administrative zones, called Imperial Leagues. While the German princes guarded their power and privledges jealously, they had been flirting with the idea of more centralised authority for a while so that they could band together for their own mutual protection.
The religious situation in Germany
Germany was the birthplace of Martin Luther, the father of the German Reformation. Luther attacked the Roman Catholic Church, particularly its selling of indulgences (an indulgence ensured God forgave your sins) in Germany. A new religion, Lutheranism, was founded along lines in contention with the Catholic Church. Things started to go badly wrong when some German princes began to reform their states along Lutheran lines. Luther himself lived under the protection of Elector Duke of Saxony.
Charles banned Lutheranism in Germany, and summoned Luther to the Imperial Diet of Worms in 1521 to explain himself, and hopefully be persuaded to recant. Luther was promised safe passage to and from the Diet, and being the good Christian knight he was Charles kept this promise. However, the Diet found in favour of the Emperor and Luther was excommunicated by the Edict of Worms. The effectiveness of this was not massive, however - many German princes chose to ignore it, and with his lack of central authority and problems elsewhere Charles largely appeased the Lutheran princes for 20 years after the Diet.
During these 20 years, Lutheranism only grew in Germany as Luther continued to spread his radical ideas. More Princes reformed their Churches among Lutheran lines, and the movement merged with social and economic movements among the common people. The Peasants War, 1524-25 was a result of the appaling conditions in which most German peasants lived, especially in what was a time of economic stagnancy.
The Protestants formed themselves into a defensive league, known as the League of Schmalkalden. It was well-unified and had military strength, and although it professed loyality to the Emperor it was clearly opposed to him and acted against his interests. The League acted with France to frustrate Charles.
In the early 1540s, Charles decided it was time to resort to a military solution. The international situation was better for him at this time as he had just concluded a treaty with France. He began his campaign in 1546 and enjoyed a steady series of successes, including the defection of some Protestant princes, until 1552. Things started to go downhill after this (partially due to a worsening international situation), and eventually Charles was forced to negotiate the Peace of Augsburg. The Peace essentially gave in to the Protestants, and never again would there be religious unity in the Empire - Princes could rule as they wished.
Charles did not really succeed in all his goals in the Holy Roman Empire, but it can be argued that he had to sacrifice some gains there to deal with problems elsewhere. Charles was forced to make concessions to the German princes to secure their support in dealing with the threat posed by Suleiman I of the Ottoman Empire. His armies had recently marched into Hungary and the ebb of Ottoman power was now pulsing directly on the east of Christendom. Charles managed to repel Turkish assaults, and by placating the Germans he maintained the support of Princes that might have allied with the Turks (as the French did).
In general, Charles V had trouble imposing his will on Germany, when compared to his efforts in Spain or the Netherlands. When he had the co-operation of the local nobility, he was effective - when he did not, he could do little. Charles viewed one of the failures as his reign as his inability to ensure religious unity in the Holy Roman Empire. As an incredibly pious man, this affected him deeply and personally.