The MP for Richmond and Northallerton resigned as Conservative leader after the party’s worst electoral defeat in its history.