Tanzania’s President has been declared the winner of the country’s presidential elections amid deadly unrest.