Donald Trump was elected the 47th president of the United States on Wednesday, an extraordinary comeback for a former president who refused to accept defeat four years ago, sparked a violent insurrection at the U.S. Capitol, was convicted of felony charges and survived two assassination attempts.