The Conservative prime minister officially resigned to make way for fellow Conservative Theresa May as the UK's next leader.