The Second Boer War was between the British Empire and the two independent Boer republics of Orange Free State and South African Republic.
This war resulted because of few conflicts between the British and the Boers. Actually the British had taken over the Cape Colony after the Nepoleonic Wars. The Boers prematurely attacked British territory and took over some of it.
The second Boer war lasted from 1899 to 1902. It was preceded by an attempt to oust the President of the Transvaal, Stephanus Kruger. At that time the Transvaal was independent of British rule (the Boers had gained control of it in the First Boer War.) Kruger had refused to give voting and other rights to British and other non-Boer residents (known as Uitlanders) and this was what prompted the attempt to get rid of him. The attack was known as the Jameson Raid, and was supported by Cecil Rhodes, who was then Prime Minister of the Cape Colony.
However, Kruger was not unseated and still refused to make concessions. There was an attempt at negotiation, but this failed. The Boers then began to invade British territory, including Mafeking and KImberley.
The British campaign was led by Lord Kitchener. In 1902 the Boers surrendered in the Peace of Vereenigung.