He estimated the circumference of the Earth around 240 B.C.
Set Up and Observations:
Observations were made at local noon on the summer solstice, the longest day when the Sun was at its zenith and directly above the Tropic of Cancer. It was known that, at this precise moment, the Sun shone directly down a well located close to the Tropic of Cancer at Syene in the South of ancient Egypt (now Aswan) illuminating the water below and leaving no shadow. At the same moment, at Alexandria in the North of Egypt, roughly on the same meridian, the Sun at its zenith would appear lower in the sky and would cast a shadow from a tall building. The angle of this shadow indicates the difference in latitude between Syene and Alexandria and was actually measured as 7.2 degrees with a gnomon, the part of a sundial that casts the shadow.
He assumed that the Sun was so far away that the Sun's rays were parallel and that the Earth was spherical. The distance between Syene and Alexandria was estimated by travellers as 5000 stadia (788 to 925 kms - See accuaracy below), the stadium or stade being the typical unit of measurement used by the Greeks at the time.
Accuracy:
Some say the distance of 5000 stadia between Syene and Alexandria was based on travellers’ reports which indicated that camels needed 50 days to cover the trip from Alexandria to Syene and that a camel travelled 100 stadia a day. Others claim that military surveyors or bematists calculated the distance by counting steps along the route. Both of these measurements would tend to overestimate the distance since they would have followed the general contour of the Nile, which is irregular in shape rather than in a straight line. The distance between Syene and Alexandria is actually 729 kms. Apart from the (in)accuracy of the estimates, there was no standardisation of measurement units and several values/definitions of the stade were in use at the time, ranging from the length of sprint races in athletic stadia to the distance covered during a march of one minute, leading to some confusion as to the exact distances involved.
Further inaccuracies:
Syene and Alexandria are not on the same meridian arc. There's a difference of about 3°. Syene is not on the Tropic of Cancer but is situated 55 km further North, The angle of the shadow is not 7°12' but 7° 5' Using the Egyptian measure of 157.5 meters/stade, Eratosthenes error in estimating the circumference is only 1.6% from the true value of 40,008 kms. Using the Attic (Greek) measure of 185 metres/stade the error amounts to 16%.
Still, given all that, Eratosthenes was a pretty clever dude!