The Holy Roman Empire actually persisted into the early 19th century.
At this time it was centralized in the loosely defined and allied Germanic states/kingdoms.
Following the rise of Napoleon and the defeat of many different, unaligned German kingdoms' forces by Napoleon's forces, Napoleon was able to sweep across the nation we now know as Germany.
One of the first things Napoleon did was to dismantle the once-proud Holy Roman Empire as well as install a number of administrative and economic reforms.
Doing so actually laid the foundations of a (loose) sense of German nationalism that had not existed prior to this and led the way to many of the revolutionary happenings of the 19th century in central Europe (more specifically in Germany, Prussia, Hungary, Austria, Denmark, France, and many other tiny German principalities and duchies).
Sources used: David Blackbourn's History of Germany, 1780-1918:
The Long Nineteenth Century
history.stackexchange.com/users/12/Sorcerer Blob
Officially it collapsed after falling to Napoleon with the 4th treaty of Pressburg, but had been fading for some time before that.
The empire was pretty decentrized in nature, but various events such as the Peace of Westphalia after the thirty years war, which granted dominions effectively independence in all but name.
Nations, especially the Hapsburgs in Austria, looking to consolidate their own domains over that of the empires, and the thwarting of policies that would have brought more centralization to the empire's rule.
history.stackexchange.com/users/20/canadiancreed
To build on GPierce's answer, the HRE functionally collapsed much before that time.
The Thirty Years War (1618-1648) had really taken a toll on the HRE's central government.
It left the country politically and religiously divided, which was a major issue to unification at that point in time.
The country was ruled by princes who controlled city states that were loosely connected.
This remained until Napoleon, as Gpirece stated, swept across modern day Germany.
history.stackexchange.com/users/31/Jacob
The Holy Roman Empire was a bit more unified during even its latest phase than many answers have said.
After the thirty ears war many German sates rallied to support he Emperor in the period calling the Imperial reaction which lasted until the 1720s when Emperor Charles VI had to curry favor with the various states to get their support for his daughter's succession.
By 1720 Charles VI had become about as powerful in Germany as Ferdinand II had been at is peak in the Thirty Years War, but without fighting any battles.
But then he had to negotiate support for the Pragmatic sanction with the princes treating them as his equals.
If either Joseph I or Charles VI had had a son who grew to adulthood the imperial Reaction may have continued much longer and the war of The Austrian Succession might not have happened and the rivalry between Prussia and Austria might not have happened.
Also during the War of the Spanish succession Emperor Joseph
I was able to confiscate several small states in the Kingdom of Italy or Lombardy, and in one particular year he actually manged to collect more Imperial War Tax from the Kingdom of Lombardy than from the Kingdom of Germany, so Italy was not yet totally outside of the Empire.
history.stackexchange.com/users/12641/MAGolding
The Holy Roman Empire (of the German Nation) officially ceased to exist one fine day in August of 1806 when Francis II went to the Imperial Diet and resigned.
He of course continued to be the Emperor of Austria-Hungary, but that is another story.
What only a small number of people thought about was the fact that for the first time since 31 BC,there was not a single political institution called "Roman Empire".
In that year, when Octavian had fought the Battle of Actium and established himself as Princeps (First Person) in a situation that was widely regarded as an imperial arrangement, there had been a Roman Empire of some sort.
Whether as a Principate, a Dominate, an Eastern and a Western Empire, an Empire in the East that called itself "Romaioi" (Greek for "Romans"), or as a Germanic Empire that called itself "Holy Roman", there had ALWAYS been a Roman Empire!
And yet, as TS Eliot would later say of the world, it died, "not with a bang, but a whimper".
Why did it die?
Well, it failed to make a Nation-State out of Germany.
It failed to ever have a stable method of succession to the throne.
And the Emperors had a hard time justifying their right to rule, given the first two limitations.
Of course, the immediate cause of death listed by the Coroner was the Battle of Austerlitz and the creation of the Confederation of the Rhine.
But the above three reasons had rendered the Empire impotent for years.
As I stated in my answer on Frederick II, the book will be out in a few years and then you will know WHY those three things above happened as they did.
But for now, those reasons are sufficient, as explaining why the reasons obtained will be a book-length answer.
history.stackexchange.com/users/17518/James Payne
When Frederick II came to the throne in 1215, he tried to extend the HRE even more towards Italy (his father married the heiress of the throne of Sicily).
His main ambition to create such an empire was because of the constant clashes with the papacy.
His vain efforts to gain strength in Italy only weakened him in Germany, leaving the German dukes and princes free to govern Germany.
After the death of Frederick II, the HRE rapidly declined.
The German monarchs continued to be called HRE emperors, but they held little power.
history.stackexchange.com/users/16/Daniel says Reinstate Monica
The Holy Roman Empire was never a real "country," but rather a motley confederation of mostly independent (mostly German-speaking) states.
During the Middle Ages, it did, however, prove itself capable of rallying behind an elected Emperor for crusading or other religious purposes.
In contrast to other answerers above, I date the (de facto, not de jure) collapse of the Holy Roman Empire to the Thirty Years War, 1618-1648, between the Swedish-led (Protestant) north German states, and the Austrian-led (Catholic) south German states.
By splitting the "empire" into Protestant and Catholic camps, the long war destroyed the common ethos that had hitherto bound the different states, and made the "confederation" a shell of disunited, often warring entities.
history.stackexchange.com/users/120/Tom Au
In the 1500's, the Holy Roman Empire was a relatively powerful country. By the mid 1800's, it seemed to be superseded by in importance by its states.  When did the unified "Holy Roman Empire" really collapse and why?
When did the Holy Roman Empire collapse?
history.stackexchange.com
<holy-roman-empire>
history.stackexchange.com/questions/13
history.stackexchange.com/users/None/
The Holy Roman Empire existed until the early 19th century. It failed to ever have a stable succession to the throne. It officially collapsed after it fell to Napoleon. The Holy Roman empire officially collapsed in the 19th century following the resignation of Francis II. The collapse was due to multiple factors, including Napoleon's activities, the competing interests of individual member states and not having a stable succession protocol.
The Holy Roman Empire existed until the 19th century. The Holy Roman Empire officially collapsed following the 4th Treaty of Pressburg. Its collapse was partly due to not having a stable succession protocol. Its collapse was partly due to its interests being in conflict with the individual interests of its member states. The Holy Roman Empire officially ended in 1806 when Francis II resigned.