Once upon a time there was a place called Rome. It was a city and a nation. It was imperialist.
There came a time when they stopped expanding. They were happy with what they had and felt that they were being stretched thin on all fronts with this whole expansionist policy.
So they fortified their borders and worked on making things good on the inside for a while.
This went well for a time but the problem with autocratic rule is that sometimes the person in charge is stupid, or evil, or incompetent, or all three.
Eventually Rome could no longer defend itself and turned to others to augment their army. There were plenty of others to be found, it turned out. More often than not, whoever was threatening Rome at the time needed to displace other people to actually reach Rome.
Refugees want land. They want a place to call their own. People generally also like to be fed and to not be used as cannon fodder.
So the bargain was struck. Repeatedly. It usually went like this:
Rome: We'll give you what your people need if you'll enlist in our military and help us fight [something].
[Training, then fighting, ensues]
Troops: We held up our end, now give us what you promised.
Rome: We've changed our minds.
Troops: What. The. Fuck.
Rome: Fuck off.
Troops: You do realize that we're now an army with the best training you had to offer and that we have an intimate knowledge of your battle tactics, right?
Rome: Shit. Why does this keep happening to us?
The city of Rome was not always sacked. Sometimes they threw open the gates and said, "You win, take what you want." Somewhat more dignified than being sacked.
For just a couple of the examples:
The first sacking wasn't actually about land. They got their land, they were just treated like shit and didn't get their fair share of the food.
Alaric, trained by Rome, led his troops, trained by Rome, in invasions of Greece and Italy.
He made it near Constantinople, but wasn't in the position to lay seige to it so he just went back to Greece and did whatever the hell he wanted. Then he went to Italy. In 410 he sacked Rome.
Rome would be sacked again 45 years later.
This time it was the Vandals, they were Roman Allies. Rome gave them land, but more importantly Rome gave them a promise of lasting peace, secured through royal marriage.
Rome broke that promise, the Emperor turned tail and ran, Rome was sacked. It's recorded as a relatively peaceful sacking, but that's in dispute because other records seem to indicate otherwise.
The traditional date for the fall of Rome is 21 years later (476). That's when Odoacer became King of Rome, replacing the Emperors.
Odoacer was a member of the Roman military, no one is really sure what tribe he called his own because by that time the Roman military was composed more of non-Romans than Romans and they were of various persuasions. All that's really known is that the various refugee populations that made up the non-Roman portions of the Roman military had been promised land in exchange for service. They wouldn't be refugees in Roman territory anymore. They'd be people with homes and lands of their own.
Odoacer was one of them. A foreigner who wanted a place to call his own instead of being forced to live as a guest on other people's land.
When the job was done he came to the one in charge (not the emperor, who was not yet of age) for the promised reward. The guy reneged.
Pretty much all of the refugee troops flocked to him and rebelled alongside him. They too had been promised homes, after all.
The Roman Empire ended.
A barbarian was king of the scant remains.
Of course by this time there were two Roman Empires. The eastern one survived.
The Eastern Emperor was growing increasingly wary of Odoacer and did something unheard of: he made a deal and stood by it.
Theoderic was the leader of the Ostrogoths. They were foreign soldiers living on Eastern Roman lands. The Eastern Emperor offered them a land to call their own: Italy.
You see Odoacer, though king, was theoretically subservient to the Eastern Roman Emperor. This this was basically (on paper at least) putting down a rebellion and in exchange they would be given the land under rebel control.
Theodoric killed Odoacer and got his reward. The Ostrogoths called Italy their home and did the only thing that the Eastern Emperor had asked for in exchange*: they treated the Roman citizens with respect and let them live under Roman law.
The Eastern Empire was thus not attacked by Theoderic.
Every time Rome failed to respect its troops, it got its ass kicked.
* It's worth noting that, though the Ostrogoths had to fight to gain Italy for themselves those who did the fighting were members of the Eastern Roman army at the time. The Eastern Emperor didn't just give them the idea to invade Italy with his blessing, he gave up part of his army by releasing them from their obligation to him and letting them live as they wished in Italy without the rest of his army coming after them as deserters or trying to take Italy for his direct rule.