The UK has announced it is giving up sovereignty of a remote but strategically important cluster of islands in the Indian Ocean after more than half a century.