What exactly occurred differently in these two realms that states like France (and others like England and Spain) became centralized, unified kingdoms in the early Modern period while the HRE became a scrambled mess of states?
In the High Middle Ages, both realms seemed to be quite similar in that they were both realms with a feudal hierarchy with a similar level of centralization, but as time went on the HRE became more and more decentralized while France the opposite. Eventually this culminated in France becoming completely centralized with absolutism and the HRE becoming a mere figurehead.
What exactly caused this divergence?
This is an extremely old and extremely contentious question in the historiography, and there's no really solid answer to point to. Although German historians have tried to point to a number of different kings and emperors as being "the one" to mess everything up for the nascent German nation state, nobody has managed to "make those charges stick," so to speak. Despite how you've framed this question, France and the Holy Roman Empire were not as similar politically as one might think. This might point toward the best answer to this question. Germany was significantly different politically from France and England, and thus it did not form into "the modern nation state" on the same timeline as they did. However, it's very hard to account for all the variations that occurred over the course of the Middle Ages. Below is an attempt focused mostly on the political power of the kings.
For starters, neither Germany nor France were "realms with a feudal hierarchy," as feudalism wasn't an actual political force. There was recently a nice discussion on the problems with feudalism, which you might want to read if you're interested in this.
The better explanation of the differences between the two kingdoms comes from the political situation of their kings. The French king started out as a figurehead. After the collapse of the Carolingian Empire, the French nobility elected Hugh Capet, a great magnate in the Île-de-France, to be king in 987. This election saw the beginning of the Capetian line of kings. However, at the beginning, the Capetians had no real power outside of the Île. They were largely figureheads. This began to slowly change, beginning with Louis VI (reigned 1108-1137) who began to move to solidify royal power in the rest of his theoretical kingdom. This process was accelerated by Philip II (1180-1223), who reclaimed Normandy from the English kings and otherwise massively expanded the royal demesne.
These expansions led to the implementation of a stronger bureaucracy, as the kings now needed to send representatives in order to carry out basic functions of government like the collection of taxes. Since the seat of power for the Capetians was still in Paris, this meant that France eventually became very centralized, with Paris as the focus. A secondary but important point, the Capetians were a long and very successful dynasty, followed by the Valois, were a cadet branch that also was very long and very successful. This meant that there were a minimum of succession crises, the royal power was consolidated in one region, and fathers and sons might work together and carry on specific political goals.
Now in Germany, things started out similarly, maybe even a bit more favorably toward centralization than in France. Henry I, the Fowler, was elected king in 919, and he went on to found the Ottonian dynasty (named after his father, Otto duke of Saxony). The Ottonians had their power consolidated mostly in Saxony, which was actually larger than the Île-de-France. They also seem to have had more serious influence outside of their personal territory. The Ottonians fought several wars with the help of the rest of the German nobility, and they largely weren't challenged for control.
However, Otto II (the third king in the dynasty) died suddenly, and the rule of Otto III was less stable because of this. Otto III died young and without heirs, and the next king was actually a cousin from Bavaria, Henry II. Henry II was also childless. This meant that there was no clear successor to the German throne. A new election was held, and Conrad I was elected king, marking the beginning of the Salian dynasty, originally based in Franconia. These dynastic shifts continued throughout the Middle Ages, moving the center of power around Germany as they happened. On top of this, the fact that the king had to keep being re-elected meant that the king couldn't necessarily alienate the other great magnates in Germany. All of this led to less centralization in Germany than in France.
Because Germany was less centralized, a centralized government did not form. Instead, the kings ruled by traveling, a form of kingship known as peripatetic kingship (in English sometimes called the Royal Progress). Although they had bureaucrats just like the French, they didn't all centralize into one location. Instead, the king went to where the problems were, and his bureaucrats came to him. This meant that no centralized institutions of power, like the exchequer in England for example, developed. It also meant that more power was retained locally by the local lords.
Ultimately, when the HRE began to break down as a unified political system in the early modern period, there weren't mechanisms in place to retain a centralized power, because there had never been a centralized power.
Some Selected Sources:
Galbert of Bruges, The Murder of Charles the Good, Count of Flanders, trans. James Bruce Ross (the introduction by Ross talks about Louis VI in Flanders)
John W Bernhardt, "'On the Road Again': Kings, Road and Accomodation in High Medieval Germany" in Every Inch a King: Comparative Studies on Kings and Kingship in the Ancient and Medieval Worlds ed. Lynette Mitchell and Charles Melville
Francis Oakley, Empty Bottles of Gentilism and The Mortgage of the Past
Joseph R. Strayer, On the Medieval Origins of the Modern State
Gerd Althoff, Otto III and Family, Friends and Followers: Political and Social Bonds in Medieval Europe
I think the best way to explain the difference is the complicated relationship the holy roman emperors had with the popes and the catholic church in general, and their interest in Italy that took up a lot of their attention.
Many bishops and abbots in the HRE had a territory over which they were worldy rulers, under the emperor. The pope in a sense was one of them, but important other ones were the three bishop-electors of the empire itself. The popes and the emperors needed each other, but in many conflicts between them the popes seemed to come out on top. And if the emperors couldn't curtail the powers of the prince-bishops, he couldn't really limit the powers of the other princes either.
And then there's the problem of Italy. While we now tend to think of the HRE as the predecessor of Germany, for most of its history it extended into Italy, sometimes encompassing nearly all of Italy in fact. A number of emperors spent the larger part of their lives in Italy, trying to get or keep it under control. And also there they gradually gave a lot of local lords and cities more and more autonomy.
In a sense the fragmentation of the HRE is clearly the failure of the emperors. But in another sense it is the way they kept the game going, of trying to rule a seemingly impossibly large and diverse empire.
Apologies if this is not up to top tier standards, but has it ever been argued that France's linguistic diversity led to a need to create a more centralized kingdom?
Geographical differences.
Alongside the facts /u/butter_milk has provided it would be useful to understand the geography of these political entities.
Many of the maps I post here have modern borders, so take a look at this map first.
It is also important to remember some terrain features may have changed since the medieval era, deforestation and the courses of rivers for instance.
"Europeans had lived in the midst of vast forests throughout the earlier medieval centuries. After 1250 they became so skilled at deforestation that by 1500 they were running short of wood for heating and cooking. They were faced with a nutritional decline because of the elimination of the generous supply of wild game that had inhabited the now-disappearing forests, which throughout medieval times had provided the staple of their carnivorous high-protein diet. By 1500 Europe was on the edge of a fuel and nutritional disaster [from] which it was saved in the sixteenth century only by the burning of soft coal and the cultivation of potatoes and maize."
It is generally accepted transport by water was a more economical method of transporting large amounts of goods long distances than land in the medieval era. Though obviously a short distance by land might be more economical than a long distance by sea or by a river, not all rivers were navigable, sea voyages could be dangerous.
Topography.
http://andreasmoser.files.wordpress.com/2012/10/europe_topography_map_en.png
Modern day France has a long coastline stretching along the north and west coast of France, providing sea routes to a large area, the south of France is protected by the Pyrenees and Alps, only the north east is exposed to flat land, mostly in the "european plain" area.
Modern day Germany is surrounded by flat land except the sea in the north and the Alps in the south.
This suggests the Holy Roman Empire was in a more exposed position than France. A French province near the Pyrenees or the western coast would not be exposed much to foreign political influence, they might be able to trade easily but an army from Castile or Aragon would need to pass through difficult mountainous terrain to threaten them, attacking from the sea can be difficult. Many principalities in the Holy Roman Empire along the eastern or western border would have flat land between them and other countries, whereas only provinces on the north east of France were like this. In order to get the many local rulers with torn loyalties on their side the Holy Roman Empire may have had to make concessions and decentralize. Though geographical barriers only work if you control them, if the enemy gains a foothold on the other side then they offer no protection, during the 100 years war the English held lands in France and could do this and this was also a period where France was apparently more decentralized.
It is less clear but much of central Germany appears more hilly than central France. This suggests that it would have been easier for a principality in the Holy Roman Empire to defend itself from the Emperor (as well as foreign political influence) than it would have been for a French duke to defend himself against the King of France. Both France and Germany have mountainous regions near the alps, the south east of France is more hilly. These terrain features may help explain the independence of the Kingdom of Arles and Burgundy during certain periods of French history, the Kingdom of Arles lied in hilly terrain along the Rhone near the alps, the terrain possibly allowed them to resist French rule for a period and later join the Holy Roman Empire.
http://en.wikipedia.org/wiki/Kingdom_of_Arles#Imperial_Arelat
Precipitation and climate.
The east of Germany is apparently quite dry and the climate a bit different. Possibly differences in agriculture increased the need for differences in government slightly.
Waterways.
http://www.jewishgen.org/infofiles/eefaq/germany.gif
http://www.hotelsafloat.com/maps/france-rivers.jpg
Paris dominates the Seine and its tributaries. The Loire, Garonne and Seine are connected to the Atlantic and thus each other and much of coastal France. The Rhone leads into the Mediterranean and so is less accessible.
The Elbe and Weser provide access to the "european plain" region of Northern Germany, rather like the French rivers. This was apparently one of the most decentralized regions of the Holy Roman Empire in the 17th century so perhaps the influence of easy access by waterways isn't much of a factor in favor of centralization.
http://www.thebreman.org/exhibitions/online/1000kids/HRR_1648.png
The Rhine is in close proximity to France and flows through the low countries. The Danube flows deep into Eastern Europe, someone from Bavaria or Austria might have more in common with a Hungarian than someone living along the Elbe.
I am an auto-didactic plebeian, not a pro academic like /u/butter_milk and I am not as well versed on the technical details. Perhaps some rivers were not navigable, perhaps crossing mountainous terrain wasn't as difficult as I imagine, though still, geography is certainly an important factor and I believe I am in the right ballpark with most of my inferences.
I have not read a historian that argues this, but from what I know, it does not seem beyond the realm of probability that religion played a huge role in the decentralisation of the HRE and the centralisation of France. Religion, aside from being the most important tool for an early modern ruler to control his people, was responsible for most of the Western European wars of the 16/17th centuries, when much of the centralisation took place.
The French Wars of Religion (1562-1598/1629) were 'centralising' wars. The king, de facto, 'won' both wars and the factions which caused the wars, the Protestant Huguenots and the Catholic League were either broken or too weak to meaningfully destabilise central authority. After Louis XIV revokes the Edict of Nantes, he has greater control over the church and therefore the conscience of everyone in his realm. This helped in controlling, subjugating and centralising France. These wars also helped bring down the 'overmighty subject' whose defence of parochial interests was always a barrier to centralisation. The Guise were weakened, the Princes of Conde were ruined, the Bretons were weakened and the Languedoc nobles, Montmorency et al were strong, but also weaker than before. This allowed the king to (to a small extent) replace the old 'sword nobility' with new, upstart merchants who bought themselves into noble status, the 'robe nobility'. This class of nobility was more loyal to the king as they owed their status to the king and therefore were not as troublesome in terms of defending provincial privileges, which smoothed the way into a more centralised state.
The HRE's wars of religion (the Schmalkalden Wars and the 30 Years War) were destabilising. The first, ending in the Peace of Augsburg 1555 allowed vassals of the HRE to institute their religion in their lands. This erodes the power of the emperor to affect their spiritual conscience; lacking a national church which included EVERYONE and was under the eye of the emperor, there was a patchwork of national synods and breakaway churches. The second war of religion, the 30 Years War was, I believe, similar. I know far less about it, but I vaguely recall that Westphalia 1648 granted more religious freedoms and made vassals like Prussia more powerful and independent, which in turn proved subversive to centralisation.
As a side note, it is perhaps not correct to compare England to the HRE in this time period; it had significantly fewer people and was more culturally similar, and Parliament ensured a relative unity in terms of law.