The reasons for the Anglo-Zanzibar War are the usual British reason: “You don’t have a flag, you are now the property of the British Empire”.
Zanzibar was at the time a sultanate, having been founded by Omani slave traders in 1698, where ironically, they expelled the Portuguese colonists, history is full of little ironies like that.
Zanzibar was ruled by the Omanis until one of the usual dynastic struggles caused the separation, Zanzibar would continue as a sultanate under a cadet branch, with the main branch of the House of Al Said.
As part of the Heligoland–Zanzibar Treaty of 1890, Britain traded Heligoland, a tiny island in the North Sea full of Germans, in exchange for Zanzibar, become the islands full on protector.
In 1896 Khalid bin Barghash, who had recently become Sultan, tried to assert his independence.
The British didn’t care and declared war. A war that last from: 09:02–09:40 EAT (06:02–06:40 UTC), 27 August 1896.
That would be a thirty-eight minutes long war, the SHORTEST war ever fought between nations, resulting in around five hundred Zanzibar casualties, mostly civilians and one wounded British sailor.
The British then installed Hamoud bin Mohammed as the new sultan, the previous one was exlied to Saint Helena, even if he was allowed to return to East Africa much later.
The Zanzibar also lost the HHS Glasgow, a royal yacht, ironically named after the HMS Glasgow, less ironically in fact not at all, named after the City of Glasgow.
The lesson learned was don’t fuck with the British Empire prior to World War One.
The Sultanate of Zanzibar ceased to exist in 1964, the last Sultan now lives in Portsmouth.