How Do We Know how far it is to the Sun?
The average distance from the Earth to the Sun is the unit of distance used for Solar System studies. It is called 1 Astronomical Unit (AU). So, how big is an AU?
Using Newton's Law of Universal Gravitation we can show that all of the solar orbits in the solar system have a fixed relationship between their periods and their average size. This is called Kepler's Third Law and it states that for all of the planets the ratio of the orbital period (P) squared to the orbital size (D) cubed, P2/D3, is the same for ALL objects orbiting the Sun. Finding the period of many objects in the solar system is pretty easy, just watch them go around the sun and remember to take the Earth's motion into account. Using Kepler's Third Law we can find the ratio of any distance to any other distance. All that's missing is that one constant.
With current technology we can measure the distance to the other inner planets with radar. This is done by determining the time it takes for the radar signal to reach the planet and bounce back. Since d=rt (distance = rate * time), we just multiply the time by the speed of light and we get the distance. We can also use the same technique to measure the distance to any of the spacecraft we have throughout the solar system.
But these techniques weren't always available. How was it first done?
Some attempts were made by the ancient Greeks to determine the distance to the Sun but none of them had much success. The distances were just too large to be reliably measured without a telescope. In 1672 Cassini used the parallax of Mars to determine the distance to the sun. The result (140 million kilometers or 87 million miles) was within 10% of the correct answer.
Another, quite clever, method for determining the distance to the Sun was developed by Edmond Halley (of comet fame), in 1677. The observations would involve a rare event, a transit of Venus, and would need to be made from several points on Earth that were widely spaced. The transit that Halley was counting on occured in 1761 and Halley knew he would not live to see it.