Ok so, at the beginning when Smaug first attacked Dale, the city next to Erebor, they had a sling shot that was made to sling giant spears. Why did they have this in the first place? Were Dragons known to come to cities every now and then so they wanted to be prepared? Are these spears only meant for Dragons or for other intruders?
For reference, I believe this is the weapon you're referring to:
This weapon appears similar to the ballista, which was a very real historical weapon, and quite common in ancient Greece and Rome. They were used often as siege weapons, lobbing shots over city walls, but they were also used in defensive positions along city walls, making them roughly analogous to cannons.
Desolation of Smaug provides us with some more background on the weapon:
Thorin: [awed] A Dwarvish Wind-Lance.
Bilbo: You look like you've seen a ghost.
Balin: He has. The last time we saw such a weapon, the city was on fire. It was the day the dragon came. The day that Smaug destroyed Dale. Girion, the Lord of the city, rallied his bowmen to fire upon the beast, but a dragon's hide is tough, tougher than the strongest armour. Only a Black Arrow, fired from a Wind-Lance, could have pierced the dragon's hide, and few of those arrows were ever made. The store was running low when Girion made his last stand.
Thorin: Had the aim of men been truer that day, much would have been different.
The Battle of the Five Armies suggests that Balin was overstating the importance of the wind-lance; Bard manages to kill Smaug quite effectively with just the Black arrow and a makeshift crossbow1
Now we've established that, why was it there?
As the below answer notes, this weapon is unique to the movie; in The Hobbit, Bard slays Smaug with the Black arrow, a family heirloom (Though not, as I recall, specifically a dragon-killing arrow) fired from a regular bow:
But there was still a company of archers that held their ground among the burning houses. Their captain was Bard, grim-voiced and grim-faced, whose friends had accused him of prophesying floods and poisoned fish, though they knew his worth and courage. He was a descendant in a long line of Girion, Lord of Dale, whose wife and child had escaped down the Running River from the ruin long ago. Now he shot with a great yew bow, till all his arrows but one were spent.
The Bard drew his bow-string to his ear. The dragon was circling back, flying low, and as he came the moon rose above the eastern shore and silvered his great wings.
"Arrow!" said the bowman. "Black arrow! I have saved you to the last. You have never failed me and always have I recovered you. I had you from my father and he from old. If ever you came from the forges of the true king under the Mountain, go now and speed well!"
From Chapter 14: Fire and Water.
So Tolkien isn't going to give us any direct answers. The question is never addressed in the movie, but I can speculate.
The nature of dragons is well known among the dwarves: they know that dragons are drawn to gold and jewels, and they know that they've got a great store of both. My speculation is that Erebor wanted to be prepared for the eventuality, so they installed the wind-lance in Dale as a sort of forward guard. This would be in the best interests of Dale as well - a dragon attack could (and did) cause massive damage to the town.
My justification for this is admittedly shaky, but it's the best I have: If you watch the prologue to An Unexpected Journey, which depicts the attack of the dragon, notice that Thorin knows a dragon is attacking before there is any discernible sign of him. I take from this that Thorin, who seems to be in command of the Erebor guards in much the same way Legolas commands the Elven guards, is prepared for the eventuality. As Bilbo notes in The Hobbit, it does not do to leave a live dragon out of your calculations.
From a non-dragon perspective, it would also have been effective as a regular defensive weapon. Of course that assumes that they have other ammunition for it, which the trilogy provides no evidence either for or against. It also assumes that Dale has enemies to defend against, which may be possible but seems unlikely. The Wind-lance is really only a useful weapon against three types of enemies, all of which seem unlikely to attack the city:
- Ships. Unlikely enemies, since Dale is so far inland
- Siege towers. At least in the movies, the area surrounding Dale is mountainous, which isn't great for large siege engines. It's also notable that Dale doesn't have large defensive walls, the way Minas Tirith does, so siege engines aren't very useful anyway
- Airborne enemies. The only airborne creatures, other than dragons, are the Eagles and the fell beasts of the Nazgûl. The Eagles aren't hostile to the people of Dale, but it's possible that they may have had to defend against Nazgûl in the days before the dragon, but this also seems unlikely; from Appendix A, there's no evidence that the Nazgûl are active outside Mordor between when Erebor is founded in T.A. 1999 and when Dale is destroyed in T.A. 2770.
1 It's possible that Bard's home-made bow only succeeded because of the hole in Smaug's armour, while the Wind-lance would have been capable of penetrating the armour fully. This seems likely, because otherwise there is literally no defence against a dragon, but it's still just speculation.
In book-canon a probable reason is given in Lord of the Rings Appendix A III: Durin's Folk:
Most of these that escaped made their way into the North, and Thráin I, Náin's son, came to Erebor, the Lonely Mountain, near the eastern eaves of Mirkwood, and there he began new works, and became King under the Mountain. In Erebor he found the great jewel, the Arkenstone, Heart of the Mountain. But Thorin I his son removed and went into the far North to the Grey Mountains, where most of Durin's folk were now gathering; for those mountains were rich and little explored. But there were dragons in the wastes beyond; and after many years they became strong again and multiplied, and they made war on the Dwarves, and plundered their works. At last Dáin I, together with Frór his second son, was slain at the door of his hall by a great cold-drake.
Not long after most of Durin's Folk abandoned the Grey Mountains. Grór, Dáin's son, went away with many followers to the Iron Hills; but Thrór, Dáin's heir, with Borin his father's brother and the remainder of the people returned to Erebor.
The escape mentioned in the first sentence is from Moria following the appearance of the Balrog (this is given by the preceding paragraph which I've omitted).
The sequence of events is therefore:
- A Balrog appears in Moria and the Dwarves abandon it.
- Some of the survivors set up a colony in Erebor.
- Most go to the Grey Mountains where they are bothered by dragons.
- The Grey Mountains are abandoned and the survivors are split between Erebor and the Iron Hills.
All of this happened before the timeline covered by the movies.
So the conclusion is that, given their previous experience with dragons as a threat in the Grey Mountains, it seems reasonable to establish some form of defence against them in Erebor.
It's called a Wind Lance and it's specific to the movie.
According, to the LOTR wiki article on the weapon, they were installed by the dwarves of Erebor at some point prior to Smaug's attack. No real reason is given for the installation.
In Peter Jacksons Hobbit trilogy we see his depiction of the black arrow.
So what exactly is a black arrow and what do we know about it? If large iron arrows launched from seige devices are all that is needed to penetrate a dragons hide than what is the signifigance of a black arrow? Let's do a thorough analysis and come up with some rational, logical theories as to what exactly Jacksons black arrows are.
Balin: Girion, the lord of the city, rallied his bowmen to fire upon the beast. But a dragon's hide is tough, tougher than the strongest armor. Only a Black Arrow fired from a wind-lance could have pierced the dragon's hide. And few of those arrows were ever made. The store was running low when Girion made his last stand.
Dwarves are some of the finest forges throughout all middle earth and have continually been progressing in their weaponry technology as new materials were mined. Dwarves have devised weapons out of many materials of the finest grade and have a vast knowledge of the durability these materials possess. Dwarves have fashioned some of the finest iron, and steel grade weapons that middle earth has ever seen and have even advanced as far as making Mithril based armors and weapons in rare ocassions. Dwarves have a long history of confrontation with dragons due to their tendancies of hoarding treasure. Dwarves armor is naturally pretty resistant to dragon fire and Dwarves themselves are highly resistant to heat and cold. Due to their long history and experience with such matters they have knowledge of how to hold their own against dragons in some circumstances. In fact, the dwarves were one of the only races able to stand against Glaurung and make him retreat. Perhaps we can better understand some questions if we refer back to all the LOTR lore to fill in the gaps for more answers regarding visual depictions of certain matters in the movies. I think it is even speculated that Erebor had been attacked in the past by dragons before Smaug. Point being, is the Dwarves were prepared for this kind of thing and even in the movies treated it, like it was a common drill. The thing to take away from this is, perhaps the purpose and intent of Dwarven Wind lances and black arrows, in regards to why they were created and their designs in the first place.
So let's examine what we know. We know Smaug destroyed dale, than smashed right through the front entrance of Erebor rather easily, walked right through the legion of elite Dwarven infantry and shrugged off anything and everything they had to throw at the Dragon. Essentially, he basically decimated two armies of two different factions and convinced the Elves, aiding either of these two armies was useless without a means to kill the dragon.
"A dragons hide is tough, tougher than any armor".
So what would be needed to penetrate the armor? Mithril is said to be as hard as dragon scales and just a small chain mail shirt, much thinner than a dragons hide, made of comparable substance in durability, was sufficient in preventing a cave troll from stabbing through Frodo. Due to the durable nature of not only how hard a dragons scales are, but the thickness of them, we know that it would require some serious fire power and high grade weaponry to penetrate a beast that renders entire armies useless and sacks the greatest kingdom in Middle Earth at the time after destroying Dale, single handidly. Theoritically, you would need something that can cut through armor as strong as Mithril to get through dragon scales. Refering back to the lore of Tolkien, dragons scales gradually built up their strength over time as the case with Glaurung, when he was first vurnable to weapons fire when he was younger and less developed, so I also believe Smaug is a fully developed, old, Dragon.
It should also be noted that most iron and steel have distinctive colors, yet Black Arrows are black. Now given some of these observations, obviously I don't think Black arrows are made of normal material, or have normal properties to be able to punch through dragon scales, but obviously the fact that it is fired from such a device against a fast approaching dragon, 130 meters long, and probably weighing hundreds of tons will play a factor due to all the weight, coupled with the force of the weight, running into a fast moving projectile.
However another quote, perhaps, gives us more insight.
"ONLY a BLACK ARROW, fired from a wind lance could have pierced the dragons hide"
This obviously has to be a reference to the type of material it was made of, and since it is implied that wind-lances were designed to be weapons utilized at attacking dragons and set up in strategic postions inside the city, rather than the outside walls, and refering back to the lore that Dwarves fought dragons on many occcasions, we know that these weapons served the tactical purpose of killing invading dragons. These weapons were designed for this sole purpose in mind.
Disagree? Let's examine the next clue.
"and few of those arrows were ever made".
Once again, it is implied this is a extremely rare material, not easily found, harvested, or produced by convential means. If Black Arrows were nothing more than large iron arrows, they could have made as many as they needed, especially with the economy system Dale was ran on. Yet Smaug decimated two armies and convinced the Elves, that it was a pointless conflict to pertake in, without a means to kill the beast. Even after the Dragon had taken an unimaginable amount of wealth, and mighty kingdom, the dragon sat there undisputed for nearly two centuries. Both Dwarves and men, and even elves for that matter had every plausible motive to kill that dragon afterwards. The Dwarves were devided, and had everything to gain by regaining their kingdom and wealth. Nobody dared wake the beast, and the entrance was sealed. With all the advanced siege weapons the dwarves had, how easy would it have been to take giant Bastillas and await for the dragon to exit the front entrance? If wind lances with iron grade arrows were all that was needed, than why not make more? Why not create so many, that it would ensure a victory against the dragon the second time? Why up until Smaugs death was there only one remaining black arrow that remained?
Obviously, I think in Peter Jacksons films, any critical thinker can come to the conclusion that black arrows are made of a rare metal or material and given all the different things they found in the mountain who knows. Perhaps it is made from partial metoerite or bares similarities to the sword Gurthang in LOTR lore. I hope they explain the exact details in the future, but for now all we can do is speculate.