In ancient civilizations, astronomy was a serious business (among other reasons, to accurately predict the seasons), so there were a lot of scientists making very careful measurements. Even with the naked eye, you can make quite accurate observations, and the ancients used these observations well.
The first really accurate determination of the length of the year was made by Hipparchus, a Greek astronomer who lived circa 190-120 BC. He calculated a year to be 365 + 1/4 - 1/300
(365.24667) days long, which is 6 minutes/year longer than the current estimate. Before that time, most people used 365.25, which is also not too far off (11 minutes), but is likely also due to the lucky coincidence the actual value is so near the neat round 1/4 day.
Hipparchus mostly used exact measuring of the equinoxes (the moment day and night are just as long, and when the Sun rises exactly in the east and sets exactly in the west). It's possible to measure this quite exactly, up to an hour. But Hipparchus also used the data gathered by earlier astronomers, back until 432 BC (~300 years before him). When you have this large time-span, and combine multiple measurements to cancel out any errors, it's thus possible to get very accurate results. Oh, and he used solar eclipses to refine his measurements as well, though the equinoxes were more important (there are more of them).
Incidentally, he was also the first one to discredit your question ;-)
That is, what most people think of as "a year", is actually not the time it takes the Earth to complete one orbit around the Sun. It's very close, but the Earth also precesses: it's top (the poles) very slightly turn around. It also means that Polaris (our current "northern pole star") will not remain the northern pole star forever (but it will for several thousand years). This also means that the time from equinox to equinox is not exactly the same as the time it takes the Earth to complete an orbit, it is shorter by 20 minutes and 24.5 seconds.
The time it takes the Earth to complete an orbit is called a sidereal year, but the time it takes for the equinoxes to repeat (and thus the seasons), is called a tropical year. Strictly speaking, "a year" could refer to both of them, but most of the time a tropical year is meant. And a tropical year is also what our calendar is based on.
At least, the western calendar uses a value of 365.2425 days, while the modern established value for a tropical year is 365.24219 days (27 seconds shorter), and a sidereal year is 365.256 36 days (1197.5 seconds longer)
These values are all assuming a day is exactly 86400 SI seconds, without any leap seconds.