President Joe Biden has withdrawn from the presidential race four months before voters go to the polls.