The British governement made a deal, and said something onlong the lines of: "If you fight for us we will give you your independence". They fought, and got what they fought for.
What destroyed the empire was WW1 what delivered the final blow was WW2.
As for the American Independence. Well, the American army was the weakest, least trained and led by inexperienced leaders. The only reason why America won was because of France's intervention due to the Seven Years War.
Afterwards, France had its revolution (partly due to the American war) and executed their royalty into which Napoleon came into power and tried to make everyone in Europe French.