There have been plenty of revolutions over the course of history. Some of these occur when a country is revolting against the rule of another country that is occupying or in some way controlling it. Here a few examples of how a country in this situation might stage a revolution.
American Revolution: In this case, the American colonies were revolting against the country that founded its very existence—Britain. It involved a full-scale, long-term war that involved a third foreign power (France). This kind of overthrow is very difficult, as it requires a great deal of resources and manpower—manpower that is willing to fight and risk life and limb.
India: Britain colonized India in the 19th century (for the most part, although there had been some colonial activity before that). Eventually, in the first half of the 20th century, the Indian people began in earnest to try to throw off British rule. Gandhi led a nonviolent protest that brought about Indian independence in 1947. This is not the way revolutions usually proceed. It took an exceptional person like Gandhi to pull off a relatively bloodless revolt.
Iran: The Iranians lived under the oppressive Shah of Iran, who was supported by the United States. In this 1979 revolution, a religious group, radical Shiite Muslims, staged a revolution that included taking hostages at the U. S. Embassy. In this case, one group represented how most of the country felt, and exploited that sentiment—throwing off the power of the Shah (and America) in the process. This revolution was not nonviolent.
These are three different ways that a country might overthrow a foreign power. Doubtless there are more.