As indicated by Lazer in the comments, they wage guerilla war. Compare it to how the Vietcong managed to hold out against the United States army, a force which was better-trained and better equipped, but operating in an unfamiliar territory with unfamiliar enemies.
Also, consider the analysis at https://scifi.stackexchange.com/a/4059/23243:
- They aren't issued proper equipment
for their surroundings. They have
shining white armor in a jungle.
- They do not properly prepare their
defenses - there are no 'kill zones'
around the base itself, which any
military would prepare in an area of
dense foliage.
- They are forced to
allow the covert group to initially
succeed, while the Emperor works on
Luke.
Now let's consider their opposition: the Ewoks. Yes, they seem silly. They're tiny little teddy bears, they were created for marketing purposes, and not nearly enough of them were shown dying. But from an in-universe perspective, really think about what we see. These little, curious, cute fuzzballs are completely psychotic. They volunteer in HUGE numbers to assault beings who have godlike powers (comparatively), they know the area well, they've been observing their enemies for a long time. And they're strong as hell. Ewoks are seen effortlessly lifting boulders the size of their torsos and throwing them. While it's obvious that the 'boulders' were props made of styrofoam, from an in-universe point of view, we must assume they were rock.
I don't care HOW good your armor is, the kinetic force of that much rock, at that velocity, will knock you silly. And what happens when you find yourself on your ass, concussed, surrounded by primitive creatures with the strength to rend you limb-from-limb? We should be glad for the artful cuts the movie makes.
Lastly, the Ewoks are putting up a good fight, but when the Empire can concentrate firepower on them, they die easily. Presumably, if the Stormtroopers had been allowed to use the equivalent of Agent Orange to wipe out the forests hideouts, the Ewoks would have been completely crushed.