By observation of
parallax.
Edmund Halley (of comet fame) was the first to come up with the idea to determine the Sun's distance by observing the transit of Venus.
A transit of Venus means we are watching Venus pass in front of the Sun.
Parallax is the effect whereby the position or direction of an object appears to differ when viewed from different positions.
So, Halley figured that two observers on Earth, if in different locations, would see Venus cross the Sun at a slightly different time, because of parallax. The effect is exaggerated in this picture:
In this picture (assume Venus is moving counterclockwise about the Sun) we can see that a person a point A on Earth would see the transit as just starting while a person a point B on Earth would see the transit just finishing.
Halley knew, based on astronomical observations, that the distance between the Sun and Venus was 0.72 times the distance between the Sun and Earth. So, he figured if we knew the distance between A and B and could calculate theta, we could use trigonometry to determine the distance between Earth and the Sun.
It turned out that it wasn't possible to get the required accuracy of measurements this way, so it was determined that rather than taking measurements at one point in time, they could measure the time of each transit, because one perceived transit would be shorter than the other, as depicted in this picture:
Theta could be solved from this by using the Pythagorean Theorem:
The radius of the sun is phrased in arcminutes based on observation to be 15.25 arcminutes. The drift rate is just the number of degrees in a circle (360) divided by the number of days to orbit the sun (224 for Venus) and then convert the units from days down to seconds).
In 1761, scientists had an opportunity to test this out, and their results were within 2.6% of the actual distance.
In 2012 there was another Venus transit. This is a picture of the transit.