There are few sites that have instilled such a sense of mystery in its beholders as Stonehenge. But the main question still has no answer. There is no way to know what its purpose was.
It seems that Stonehenge was erected in stages by different generations over a period of about 1,500 years.
The first Stonehenge building took place in the around 5,000 years ago. Mostly this was a moving of earth. A channel was dug out in a circular configuration. The people used antlers and other bones of animals as tools, specifically antlers. The oldest animal bones in and around the channel were older than the ditch itself. The channel was finished 3029-2910 BC but the bones were 850 years older. But there is also a theory that they may have been curated for a substantial period.
The main channel had antler bones, many of them had been used to dig the channel. The bones were gathered over a period of 20-160 years. This stage provided a date of 3020-2910 BC.
The stones were the first Sarsen circle. Though this evidence isn't as reliable as might be expected as they were only able to use one time marker (one reading), it was determined that the setting was 2850-2480 BC. And that is much earlier than the blue stones.
The Sarsen Trilathon is earlier than the blue stones at 2440-2100 BC. The experts were not able to verify the age of what should have been the oldest blue stone stratigraphically. Those stones they could date were 2280-2030 BC for the bluestone circle and 2270-1930 BC for the bluestone horseshoe.
Stonehenge has plenty of legends. One of them says that the henges are actually gateways to where we originally came from. And every 5,000 years or so, someone attempts to open one of them, which brings about some horribly catastrophic event.
The most popular theory is based on a story written in the 12th century by Geoffrey of Monmouth. It tells about the king of the Britons, Aurelius, who wanted to build a monument over the site of several hundred graves believed to be slain Saxon soldiers. He asked Merlin the magician where such a monument could be found. Merlin told him to look for a circle of massive stones stood, named the Giant's Dance. The stones, had the ability to heal, were so named after a myth that they were brought from Africa long ago by giants. But the king failed to construct the same circle. And with the help of Merlin magic they reconstructed it on Salisbury Plain.
And still the main question is why people would attach such a magnitude of significance to a site that it would compel them to expend their energies as they did generation after generation for a period of 1,500 years.