Former Somali Prime Minister Mohamed Abdullahi Farmajo is elected president after incumbent Hassan Sheikh Mohamud admits defeat in a second round of voting by lawmakers.