The ANC are exceptionally stupid and have managed to run South Africa into the ground, for a variety of reasons. They're pretty tyrannical to boot, for example, sending cops in with machetes to murder striking miners. They aren't really a great example of an African success story, though Botswana, Nigeria, and several other countries have managed to achieve some level of improvement over the years.
What is Botswana doing right? They've done incredibly well so far, and I'm ignorant as to how they've done so.
-Unlike many of their neighbours, the Botswanans didn't lynch their foreigners or attack them, instead welcoming them into society. Race relations in general were quite a bit better in Botswana than in most other countries in southern Africa, which helped as well.
-They successfully established a representative democracy rather than swinging between militaristic plundering strongmen and socialist revolutionary groups every few years via civil war
-In the process, they encouraged foreign investment by guaranteeing property rights and making it clear that if you put money in Botswana it won't be nationalized for the "good of the people" next Friday
-They also avoided falling into the trap of becoming dependent on foreign aid, which has a tendency to decimate local farmers and ruin self sufficiency
Honestly, though, the big one is the fact that they avoided the cycle of "civil war-strongman loots/pillages - civil war- socialist nationalizes everything - civil war" etc, which makes all the difference. Hell,
Somalia is significantly improved because they don't have a strong enough government to steal everything or nationalize it, allowing some actual productive domestic industries to crop up.