The Spanish although the most powerful Europeans of this time, Spain having a Population of 24 Million, as opposed to 8 Million in France and England, took no interest in Africa, except Northern Morocco, close to Cadiz (her principle Military Port), Seville (her principle Commercial Port), and the Straights of Gibraltar (or Pillars of Hercilles, as it was once known by the Ancient Greeks) leading into the Mediterranean.
This was because the Pope had made a treaty between Spain and Portugal which gave the Western Hemisphere to Spain, and the Eastern one to Portugal, in order that they might convert the heathen natives to the way of Christ, both being loyal Catholic Countries. If you look at the world map today you can still see this divide today, with the Spanish speaking world reaching from the Philippines and California to Argentina. The Portuguese speaking world includes Brazil, Angola, Mozambique, Macau, and East Timor. England and France settled in North America because it was scarcely populated with only about 3 Million Nomadic Indians in the entire Continent, as one with the land. The Spanish weren't interested in Colonization, instead they found more wealth plundering the Populous Aztec and Inca Empires.
The next people to arrive in Southern Africa were the Dutch, who landed in the Cape in 1652, to found Kaapstad (Cape Town). This was not an expedition by the Dutch Government, but by the legendry VOC (Dutch East Company) in search of profit. The same company that the Ghostly Flying Dutchman Ship, reportedly sited around the Cape belonged to. The Colonies only purpose was to supply ships with provisions on their way to and from the Indies. It consisted of the Company Gardens (still there!) and a small hedge marking the boundaries of the Colony. The Natives did not mind as there were valuable trade goods to be had. The location was chosen for several reasons:
The British didn't arrive in the Cape until about 1800 during the Napoleonic Wars, when her Ally the Netherlands has been invaded by France. In order to stop Cape Town (a Dutch Possession) falling into the hands of her ancient enemy the French, it was occupied. When the War was over Cape Town was returned to the Netherlands. But a few years later, Britain the Worlds Greatest Naval Power decided Cape Town would provide a Strategic Port on the way to British India (this was before the Suez Canal had been built), so reoccupied it. Many of the local Dutch Colonists (there were also some French and Germans among them) resented rule by the British and retreated into the Interior, thus starting many bloody clashes with the Natives over Land, they were better armed however so could do what they liked.
In 1820 Britain became worried about the increasing Native raids, and like many, many Empires before her decided on a simple policy. Dump Colonists on the Frontier, this is a good Policy for Empires, but once the Empire goes, and they always do, it usually leads to ethnic conflict. The 1820 Settlers settled mainly in the fertile and less hostile coastal areas, thus pushing many Africanners further inland. Britain passed a law outlawing slavery throughout the Empire.
Some Africanners decided that the only thing to do was go far away from the British across the Orange River, and so the Great Trek began (it should be noted that more African Slaves were involved in this than there European masters). Two states were founded the Orange River Colony (centred North of the Orange River and around Bloemfontein), and the Transvaal (centred North of the Vaal River and around Pretoria).
The British also founded the new Colony Natal around Durban, and imported many Indian workers to cut sugar cane, Ghandi started his Political career there, he may have won India Independence, but couldn't change racist South Africa. Until 1980 the Orange Free State had a law that fore bad any Indians entering its territory. It should be noted at the same time Chinese people has the vote! In 1871 the British annexed the town of Kimberly from the Orange River Colony, to Cape Colony, where a vast Diamond deposit has been found, which eventually become the Monopoly of De Beer's.
So all seemed well those Africanners who didn't mind British rule could stay in the Dominions of the Cape and Natal, and those who didn't could go to the Orange River Colony, or the Transvaal. But several events happened to upset this.
The African Population of Southern Africa had increased ten fold since the European Arrival, largely due to European Powers further North dislodging them. So they kept moving South, but when they reached South Africa they could go no further, so they had to stand and fight for land. The Zulu Tribe was the principle protagonist in this, though badly armed they were very brave, and fought Africanners, British, and other Africans alike, and built a great Empire.
Eventually Britain was forced to act, in the Anglo-Zulu War of 1879, which consolidated their Power. One famous battle of this War was Rorke's Drift where about 100 British Soldiers, faced 5000 Zulus, some armed with Rifles, and lived to tell the tale. This Battle had been preceded by a British Rout, where 1000 Imperial Troops had been massacred, and their Rifles seized, due to a surprise attack, that didn't give them enough time to unscrew the lids on their ammunition boxes.
This British Victory worried the Boer Republics, leaving them increasing isolated, and with no access to the sea, and lead to the First Anglo-Boer War of 1880-81. Which ended up with the Boer Republics maintaining their Independence, but handing over control of Foreign policy to the British.
Next the Boers were cursed with the Midas Touch, Gold was discovered in quantity south of Pretoria on the Witwatersrand Farm. This lead to the growth of the City of Johannesburg (founded by Johannes somebody), and a vast influx of Uitlanders (Foreigners). The Transvaal was a Democracy for Africanners at least, Africans had no rights, and Uitlanders had to meet impossible conditions (they had to be resident for at least 17 Years before they could vote). This lead to tension between the people themselves, and Governments.
Meanwhile a Diamond Baron and Prime Minister of the Cape, Cecil Rhodes decided to claim the land between the Limpopo and Zambezi for Queen and Country, not long after Doctor Livingstone (I presume...) had charted this area of darkest Africa. A great Ruin was found which the Africans call Great Zimbabwe, it had been the Capital of a Great African Trading Empire, many Europeans refused to believe Africans could have built it, and came up will half baked theories about it being King Solomon's Mines, or being built by Cleopatra. A Colony was founded at Salisbury named after the then Prime Minister Lord Salisbury (now modern day Harare). Rhodes, rather modestly named the Colony Rhodesia. Thus the Africanner Republics where surrounded on North, West, and South, by British Colonies or Protectorates.
The Berlin Conference of 1885 had awarded South West Africa to Germany, who quickly came in, murdered 60% of the Population, and founded the Colonies of Swakopmund, and Luderitz. Britain maintained a Naval Port at Walvis Bay (still held by present day South Africa), just South of Swakopmund.
The "Gold Bugs" Cecil Rhodes and Beit, and Sir Alfred Milner, High Commissioner for South Africa and Lieutenant Governor of Cape Colony with the tacit approval of Chamberlain, Colonial Secretary (Father of Prime Minister Neville Chamberlain - Peace in out Time... Not!), collaborated in the Jameson Raid of 1895/96, an attempt to provoke an uprising of Uitlanders (non-Boer Immigrants) in Johannesburg to secure political rights, and thus outvote the Boers in their own Republic. The reasons for this were so they could gain control of the Transvaal's vast mineral wealth, and a route for the Cape to Cairo Railway (Britain at one time or another, but not all at once has controlled the entire territory from South Africa to Egypt, also from Palestine to Singapore, bar Thailand).
The 'raid' envisaged a 3-day dash from Pisani & Mafeking, before the Boers could organise to prevent it. The 'raiders' were 400 Rhodesian Police, & 120 volunteers - led by 'Dr Jim', Administrator of Rhodes' & Beit's Chartered Company (which ran Rhodesia for the Crown). No uprising took place, and they were captured at Doornkop, within a couple of hours ride of Jo'burg. Jameson took the blame, but Rhodes was forced to resign as Chairman of the Chartered Company, and as Cape Prime Minister. Kruger became a hero overnight, and was elected to a fourth term as President in 1898. The Jameson Raid was the real declaration of war in the Great Anglo-Boer conflict, and that is so in spite of the four years truce.
Once the War actually began the Boers laid siege to Mafikeng, Kimberly and Ladysmith. Mafikeng employed boy scouts to gain intelligence, this was later developed by Baden-Powell into the World Scout Movement. They never actually took them, but came very close. When the siege was finally lifted by British and Australian reinforcements, the British went on to capture the Boer capitals of Blomfontein, and Pretoria. They thought that was that, but some Boers the "Bitter Enders" refused to surrender and fought on using guerrilla tactics, strike and flee, live off the land. The British controlled the territory next to the Railways but were forced to build Blockhouses (small Forts) every mile with barbed wire, to contain the Boer Commandos, first burn farm houses, and then place Boer Women and Children in Concentration Camps, so they couldn't provide the Commandos with food and intelligence.
At the height of the War Britain had 500,000 Imperial Troops involved, 20% of whom were Afrikaners, half of which were ill with subtropical diseases. The Boers never had more than 30,000 Men active at any one time, including 5,000 Foreign Volunteers. Most Volunteers came from the Netherlands (and Dutch Speaking Belgium), and Ireland (including Irish Americans). Their were also Corps of about 100 each from Scandinavia, Switzerland, Russia, and Italy, and some French who guarded the Gold Mines.
The Conditions in the Concentration Camps deteriorated, with little food, heat stroke, and disease - this was more due to bad management by an Army unfamiliar with such things, than malaise or tactics, but in the end it forced the remaining Boers to surrender, after 250,000 had died.
In 1910 at act of Union was signed between Transvaal, the Orange Free State, Cape Province, and Natal. thus creating the Independent Dominion of South Africa. The British Protectorate of Basutoland (present day Lesotho), although totally surrounded by South Africa, never joined and is still Independent, due to its lack of a European Population. South Africa was a close Ally of Britain during both World Wars, where many of her Soldiers served in Egypt, Palestine, Libya, Tunisia, and Italy. During the First World War her troops captured German South West Africa, which then became a possession of South Africa.
Some time after the Second World War when African nations where winning their Independence South Africa withdrew from the British Commonwealth of Nations and became a Republic, implementing right wing, racist policies. This situation was allowed to persist during to Cold War as she was a useful Ally against the Communists in Angola (originally supported by Fidel Castro and Cuba), and Mozambique. So at this time it looked like the Africanners had lost the War and Won the Peace, having removed the British from their Continent, and implemented their hated Appartite Policy.
However she became ever more isolated, in 1980 the minority White Government of Rhodesia fell, and in 1990 Namibia (South West Africa) became Independent. The Cold War was ending which lead to crippling sanctions, which combined with the pro-democracy movements, of the ANC, the Zulu Incarta "freedom" party, liberal English speakers, and Africanner businessmen lead to full democracy. This democracy has not delivered all people would have hoped for, partly due to years of neglect, African education boycotts, and a high birthrate (the population doubles ever 25 years). The ANC government hasn't even managed to build as many houses as the previous undemocratic government, a quarter of the population has aids, crime is at epidemic proportions, 500 White farmers have been murdered in cold blood, and many skilled workers have emigrated (1 millions whites hold British Passports). This shows stable democracies can only thrive in well developed societies.