Barack Obama rang Conservative headquarters on election night with a mistaken but reassuring message for Theresa May because Labour insiders had told him the party was expecting to lose seats, according to a new book about the election.