The morale shock of losing a second death star, the fleet and flagship protecting it, several admirals, Darth Vader, and the Emperor all at once would probably cause many Imperials to just surrender. The Imperials are not an ethnic group fighting to defend a homeland; their raison d'etre was the Emperor (ie fear, maybe some grandiose idea that they are part of some great empire that is only 20 years old, and a paycheck), who just got blown up. Some might rally behind some lesser Imperial officers, but given that the Emperor just got blown up by the rebels, and more planets are going to rally behind and support the Rebels given their triumph, your average Imperial probably won't be very optimistic about their chances and would be dissuaded from continuing on. The Imperials also don't lose anything from surrendering. It's not like the Rebels are vengeful and are going to burn their cities down and rape their women or stuff like that. In fact, Imperials could probably find new employment right away working for other planets' navies or the New Republic. Any Imperial remnant factions that would continue to fight on would be small.
The impression I get from the original EU (although SW as a whole is not very good at geo... uh,
astro-political... analysis) is that there were several factors at play:
-- A lot of the high command was and
remained dedicated even after Palpy died because 1) they were old enough to remember the chaos of the Clone Wars and from
their (biased) perspective the Empire was
definitely an improvement, and/or 2) the Empire actively selected for fanaticism, so even younger members of the really high ranks were
in that position because they were ride-or-die for the New Order, or just very dedicated to authoritarianism in general.
-- A lot of the mid-level command actually
did defect (that's where the Rebels got the bulk of their experienced leadership cadre), but the ones that remained were by default the really radical types. You see a
lot of relatively young, fanatical Imperial commanders (often in the service of the aforementioned higher-ups), post-Endor. These are people raised and indoctrinated into the New Order from a young age. The
Palpatinejugend all grown up, so to speak.
-- A lot of the rank-and-file stay because it's the only certainty they have. You stick with your commander because he says he'll keep the pay coming, or you risk going over and surrendering. But then what? The Republic hires good pilots, sure, but what do they need all those poorly-trained stormtroopers for? You'd have to get a job, and you're basically hard up for useful skills... so what's to become of you? New Republic's gonna bring back the free market, abolish the command economy... no
way they're keeping a gazillion legions around. So you, stormtrooper 346365647445688, can look forward to unemployment and homelessness. Maybe best to stick with High General Fucktwit Arseholius III, Supreme Overlord of the Nether Brexbend Sector. It's shitty work, but at least it's work...
(And then later, when all the attempted resurgences have been tried, we get the impression that all that remains are the "unreconstructed few", following Pelleaon out into the sticks to set up the Remnant. By that point, the Imps hold
eight sectors. So, yeah... on a galactic scale, not many of them left.)
...Of course, this process of whittling down the Imperials to the small remnant took a good fifteen years, and there were several times where Imperial attempts at reconquest nearly succeeded in gobbling up at least major segments of the galaxy. They were shattered successor states, but they were well-armed, and the realities of the situation meant that they soon became pretty meritocratic (as tends to happen, when failure means death; the
stupid warlords fell quickly, the
smart ones lasted).
In Disney's time-line, meanwhile, everybody is incredibly stupid for absolutely no good reason.