The study of the size and shape of the earth is known as geodesy and has been practiced for centuries. Contrary to common misconceptions, many historical mathematicians and scientists were aware that Earth was spherical. Technically Earth's shape is called the "geoid", an ellipsoidal shape. Possibly starting with Eratosthenes, over 2,200 years ago, mathematicians have attempted to calculate the size of a spherical or ellipsoidal Earth. The techniques of Eratosthenes and his predecessors are considered elementary, or at least straightforward, for today's mathematician, but are impressive for their scope in calculating the entire Earth without being able to see or measure most of it and for their accuracy.
One of the oldest and still most useful applications of mathematics is using geometric relationships to derive the dimensions of things without directly measuring them. About 2000 years ago, an ancient Greek scholar, philosopher, poet, and mathematician named Eratosthenes used staggeringly simple geometry to calculate the size of Earth with very high accuracy. The ancient Greeks were remarkable for their ability to use geometry to describe the scale of things that they could not directly perceive. Their geometry was always correct and clever, but their conclusions were often way off. (Due to inaccuracies in the measurements that the calculations were based off of.) The scale of Earth is one measurement that they might have got pretty close.
Eratosthenes of Alexandria (276-195 BC) was born in Cyrene (modern Libya), studied in Athens, and became the head librarian at the Library of Alexandria. The Library of Alexandria was the center of knowledge in the Hellenic world. Learned men of the ancient world were not fettered with specializations. Eratosthenes first gained fame as a poet, invented the first system of latitude and longitude, calculated the tilt of the earths axis, invented the discipline of geography, developed an algorithm for calculating prime numbers, and was the first person to attempt an accurate map of the world based off of physical data. Supposedly, his colleagues nicknamed him , because he was reputed to be at least second best in the world at just about everything.
The map above was assembled from land surveys and celestial observations conducted during the time of the conquests of Alexander the Great. It covers an extremely large portion of Earth, despite when it was created. Much of the information in the map was probably passed from word of mouth and through the compilation of many observations made by many people over a long period of time. It also does a relatively impressive job of portraying the rough shapes and directions of land masses, oceans, and rivers.
From his map, it can be concluded that Eratosthenes had no first-, second-, or third-hand knowledge about an entire hemisphere of the earth, and most of Asia and Africa. Despite this, using simple geometry, he was able to deduce the size of the earth, and hence the amount of the planet that was unknown to him.
He observed that at noon on the summer solstice of the northern hemisphere, at two different places, the sun’s rays fell upon the earth at different angles. In the city of ancient Syene (modern Aswan, Egypt), at noon on the solstice, the sun was directly overhead and cast no shadows on the objects below it (Aswan is very near the Tropic of Cancer. This was proven by observing that the sun completely illuminated the bottom of a very deep well in Syene at noon. The angle between the sun's rays and objects perpendicular to the earth's surface was effectively zero.
In Alexandria, on that same day at noon, the sun cast slight shadows behind objects. By measuring the dimensions of the shadows and the objects that cast them. Eratosthenes was able to calculate that the sun’s rays arrived in Alexandria at an angle of of a circle (about 0.13 radians or 7.2 degrees). He knew the distance between Alexandria and Syene to be “stades” from land surveys done between the two cities. A stade was an ancient Greek unit of measurement (150-200 meters). He also assumed that Syene was due south of Alexandria and on the same meridian of longitude. This would mean that the distance between the two cities represented an arc of the earth's circumference (in reality, Aswan is about three degrees of longitude east of Alexandria).
Eratosthenes assumed that the sun was far enough away from the earth that its rays arrived at the Earth parallel to each other. In the diagram above, is the angle that the sun’s rays arrived to Earth at Alexandria on noon of the solstice. represents the angle subtended at the Earth’s center by the arc representing the distance between Alexandria and Syene. From the equivalence of alternate interior angles across a line transverse to two parallel lines, of a circle. Since angle B is th of a circle and sweeps an arc at the earth’s surface of 5,000 stades, the Earth’s circumference would be stades.
Because there is a scholarly debate as to what the definition of a “stade” is, there is no way of knowing exactly how close Eratosthenes was to today's currently accepted value for the circumference of the earth. It is thought that a “stade” is defined as the length of an Ancient Greek stadium used for athletic competitions. Most of them are about of a mile, but some are longer and some are shorter. There is evidence that the word stade meant different things in different contexts, at different times, and in different places. It is not certain which definition of stade Eratosthenes used. The actual circumference of the Earth is km at the equator.
Regardless, he calculated the size of the earth to within an order of magnitude and possibly got very close. He also may have been lucky. Errors could have arisen from: a) the fact that Syene and Alexandria are not exactly on the same meridian of longitude; b) significant errors in measuring the distance overland between Alexandria and Syene; or c) in measuring the angles cast by the shadows at Alexandria.
It is a common modern misconception to assume that past civilizations believed in a flat earth of unknown dimensions. Eratosthenes's calculation proliferated far and wide and was preserved by successive generations and geographically disparate civilizations. This estimate of the size of the earth and its method would remain canonical for the educated elite of the future civilizations of Europe, North Africa, the Middle East, and South Asia until the 17 century when more precise measurements could be made to constrain the size of the earth.
Aryabhata was an Indian mathematician who lived from 476 to 550 AD and accurately wrote of the earth as being spherical. He also estimated the circumference of the earth to within 67 miles of modern measurements, off only by approximately 0.27%. 
Abu Arrayhan Muhammad ibn Ahmad al-Biruni
A Persian mathematician who lived from 973 to 1048 AD, Al-Biruni used triangulation to measure the earth. His estimate was that the earth had a radius of 6,339.6 km, which is 16.8 km less, also approximately 0.27% off from modern measurements. 
In 1906, the German geodesist Friedrich Robert Helmert determined that the earth was a global ellipsoid and calculated it to within 100 meters, 0.002% of modern measurements.
- O'Connor, J., & Roberston, E. Aryabhata the Elder. Retrieved March 23, 2016, from http://www-groups.dcs.st-and.ac.uk/~history/Biographies/Aryabhata_I.html
- O'Connor, J., & Roberston, E. Abu Arrayhan Muhammad ibn Ahmad al-Biruni. Retrieved March 23, 2016, from http://www-groups.dcs.st-and.ac.uk/~history/Biographies/Al-Biruni.html