African countries achieved independence in different forms. For example, Liberia became a country in 1847 after freed African-Americans went there to found a colony. Their efforts were supported by the American Colonization Society, which had been founded in 1816 in the United States with the purpose of repatriating African-Americans to Africa, as they thought this was the best route towards African-American freedom.
In 1910, South Africa became independent after Britain fought the Second Boer War (1899-1902). England had faced resistance to their rule from both Zulus and the Dutch-speaking South Africans in the Boer Republics. In 1931, South Africa became fully independent of Great Britain. In 1922, Egypt became independent from Great Britain after a century of British control. However, the English continued to control foreign affairs, the Sudan, and the military until the kingdom of Egypt became a republic in 1953 (and Sudan became independent in 1956).
Many of the other African countries were granted independence following World War II. Franklin Roosevelt and Winston Churchill had signed the Atlantic Charter in 1941, recognizing the rights of all countries to sovereignty. After World War II, Britain was pressured to recognize the independence of its colonies, and it also found them expensive to administer. Kwame Nkrumah declared independence for his nation, Ghana, in 1957, and Ghana became a republic in 1960. Nkrumah was an advocate of pan-Africanism, a concept advocated by W.E.B. Du Bois and others that supported a unified African identity and resistance to colonialism. Other countries, such as the Congo, Cameroon, Senegal, Nigeria, Sierra Leone, Rwanda, Kenya, and others, became independent in the 1960s. Other nations gained independence in the 1970s. Eritrea became a nation in 1993 after fighting a war of independence with Ethiopia, and South Sudan became a nation, winning its independence from Sudan, in 2011 after voting in a referendum.
Mozambique, like Angola, was also involved in a bloody struggle against Portugal for independence. Also like Angola, they received direct military aid from Cuba. Even the relatively peaceful independence movements, like in Ghana and Kenya, also saw rioting and some violence. In Zimbabwe, a white-led government (known then as Rhodesia)broke away from Britain, resulting in fighting with African revolutionaries. One very interesting exception to colonial patterns was Liberia, founded in the mid-nineteenth century by freed slaves who had come there with the help of the American Colonization Society.
Most of these countries achieved independence simply by being granted it by their former colonial rulers. There were some, such as Angola, that fought for independence. But more of them were like Zimbabwe which was simply granted independence by Britain.
Skilled speakers such as Kwame Nkrumah in the Gold Coast, Jomo Kenyatta in Kenya, and Léopold Senghor in Sengal led independence movements in their countries. Such political pressure was enough to win independece in the British colonies that became Nigeria and Ghana, and in France's many Western African colonies.