How does the earth orbit the sun?
Because of Newton's first law of physics.
Newton's first law of physics states that a body in motion tends to stay in motion and in a straight line unless acted upon by outside forces. In the earth's case, that outside force is the sun's gravity will constantly pulls the earth out of its straight line desires into a curving motion we are familiar with.
In reality no two bodies orbit each other. They actually orbit the centre of mass of the system which is called the barycentre.
The Earth and Moon both orbit about their centre of mass called the Earth-Moon barycentre.
In the case of the solar system, the Sun and all of the planets and other bodies always orbit around the Solar System Barycentre (SSB).
So, the focus of the Earth's orbit is the SSB which is in constant motion.
The position of the SSB is constantly changing. It can be anywhere between the centre of the Sun and two solar radii from the centre of the Sun. This depends on the relative positions of the planets and other bodies.
The diagram shows the position of the SSB over a period of decades.