Specifically subsaharan African countries. I'm aware that during the 17-1800's (I think) there were a lot of power struggles between European countries over who could colonise what area in Africa. North Africa probably has a larger white population I'm assuming partly because it is quite close to Europe, but the only other country I know of is South Africa. Why is this when almost every other country was also colonised to some degree?
Interesting question! But I would argue your initial premise is wrong. White populations in Africa are more a result of Economic and political factors then geography. This is seen in most settler colonies being in Southern Africa (ex South Africa, Rhodesia, Angola) although there are exceptions (Algeria). And the reason for the move of white populations has more to do with the Cold War and the 20th century then any earlier period.
The short answer: South Africa was the last African country to decolonize and its white population had longer ties to the land.
The long answer: Settler colonial states in Africa all had violent transitions of power or at least violence spurring on the transition of power. From Algeria to Kenya to Angola removing the white settler was a rallying cry for black liberation movements and revolutionaries. To them the project wouldn’t be completed until they were back in control.
Additionally, (generally speaking) the whites living in these areas were not as attached to the land. For a family living in say Kenya for a couple generations it was preferable to move back to the UK then live under African rule. In cases where whites had stronger connections to the land in places like Zimbabwe it is worth noting that the leader there, Mugabe, made a point of trying to force whites to emigrate by seizing land and businesses.
Now let’s look at the case of South Africa specifically. South Africa has and has had the largest white population of any settler state in Africa. And on top of that many of the families there had been living there for many many generations (some going back to the 1600s). And they identified as South African- going to the UK was already highly unlikely for the English speaking whites and going to the UK or Netherlands for the Afrikaans speaking whites was impossible.
Additionally, the black revolutionaries that ascended to government after the end of Apartheid (the ANC) also had no interest in creating a black only state, in fact that would run counter to their political messaging which won them so much support from all over the world. The ANC was a multiracial party and movement which included Indians and whites as well as blacks. And while the ANC did use violence, there was no race war or large scale local revolution inside South Africa that would have pushed race relations to the brink. Instead there was free and fair elections that opened South Africa to democracy and a multiracial society.
I hope this helps answer your question! If you have any other questions or need clarification don’t hesitate to ask! :)