That's simple theory of gravitation- class 11th
To avoid falling into the Sun, the Earth need to counteract the force that is pulling it towards the Sun.
The force that pulls the Earth towards the Sun is gravity. We can describe that force as:
F=GmM/r2F=GmM/r2
Where G is the gravitational constant, m is the mass of the Earth, M is the mass of the Sun, and r is the distance between the center of mass of the Sun and the center of mass of the Earth.
An object traveling in a circular path has a fictitious force called the centrifugal force. We can describe that as:
F=mv2/rF=mv2/r
Where m equals the mass of the object, v equals the velocity of the object, and r equals the distance between the center of the circle and the center of mass of the object.
So, for a stable orbit, these two forces are equivalent:
F=GmM/r2=mv2/rF=GmM/r2=mv2/r
We can see immediately that we can remove m from both sides, telling us the mass of the planet is irrelevant. We can also remove one of the r, so:
GM/r=v2GM/r=v2
Rearranged, we can determine that as long as the Earth is traveling at a velocity tangential to the circle that describes its orbit of a certain amount, we will have balanced the system:
v=GM/r−−−−−√v=GM/r
That tells us that as long as the Earth moves forward at that velocity, it will stay at a relatively fixed distance from the sun. For the Earth, that is 29.747 km/s (66,542 miles per hour). For every distance the Earth falls towards the sun, it moves forward enough to maintain the same radial distance.
Note: For simplicity I've talked as if the Earth's orbit is a circle. It's actually an ellipse, but Newton proved the same concepts hold true, we just redefine the "r" by using one of the foci of the ellipse.
That's why the earth not get pulled.