In the films, Thorin talks to Fíli as Fíli is his heir, yet a few people I know said in the books that
even if Fíli or Kíli had lived the throne still would have went to Dáin Ironfoot.
Why is this?
To my absolute surprise, it seems he would have been. The events of the Hobbit as recounted in the appendices of the LotR read:
There fell also Fíli and Kíli, his sister-sons. But Dáin Ironfoot, his cousin, who came from the Iron Hills to his aid and was also his rightful heir, became then King Dáin II, and the Kingdom under the Mountain was restored, even as Gandalf had desired.
Dain being Thorin's rightful heir and not Kili's / next in line to Kili does seem to strongly imply that Dáin would have inherited the throne regardless of Fili and Kili being alive.
I'm going to vastly oversimplify some common rules of succession to try and explain how this issue might be resolved. Please note that (to my knowledge) Tolkien has never indicated what rule of succession the Dwarves follow.
I'm going to assume, as you do in your question, that Fíli and Kíli survived the Battle of the Five Armies, because otherwise it's a moot point. I'll also assume that their mother Dís is alive, although we have no canon to confirm or deny it, because it's easier than constantly saying "If Dís is alive then..., otherwise...".
First, I refer you to the family tree of Durin the Deathless (the information here is taken from Appendix A: "Annals of the Kings and Rulers", though the image obviously is not):
Cognatic primogeniture. Vastly oversimplifying, this means that succession is a depth-first search on the family tree, preferring the oldest children. Typically this rule has preferred male children over female (a variation of which is sometimes called "Male primogeniture"2). Under this rule, succession would be determined like so:
After Dís's death, the Crown would pass first to Fíli and then to Kíli.
Salic Law, Variation 1. Salic Law is similar to cognatic primogeniture, except that it excludes females kin from the line of succession. In the first variation I'm going to look at, the entire female line is considered "naturally dead"3. In this case, the succession would be determined like this:
Under this rule, neither Fíli nor Kíli would ever become King Under the Mountain.
Salic Law, Variation 2. Under the second variation of Salic Law, female kin are considered "naturally dead", but their sons are in the line of succession. How this plays out is essentially the same (in this case) as with cognatic succession, except the Crown skips over Dís and lands directly on Fíli.
As previously noted, we have no idea. Tolkien was presumably not interested in the topic of succession, so we have no Word of God answer on the subject. Considering that Dís is literally the only Dwarf female identified in Tolkien's writings (and Tolkien identified a lot of Dwarf kings, as you can see from the above image), it's a fair assumption that they follow a variation of Salic law, with no Queens allowed, but exactly which version they follow is unknown, and there are no clues to help us sort it out.
There's at least one (rough) anecdote to support that claim, from a footnote in History of Middle Earth, when discussing the reincarnation of Durin:
What effect would [Durin's reincarnation] have on the succession? Probably this 'return' would only occur when by some chance or other the reigning king had no son. The Dwarves were very unprolific and this no doubt happened fairly often.
History of Middle Earth XII: "The Peoples of Middle Earth" Chapter XII: Last Writings Of Glorfindel, Círdan, and other matters
Although this is obviously not conclusive evidence, it does suggest that daughters were not considered eligible to succeed.
To be honest, I rather suspect that Tolkien chose to end the line of Thráin II just so he wouldn't have to make a decision on this point.
1 There are many more rules than this, obviously; no two monarchies do it quite the same way. The ones I've listed here, though, are the most relevant.
2 For reference, male primogeniture was how succession of the British Crown had worked (with the added caveats that illegitimate children and Catholics were always excluded) from 1701 until something happened that made the Royal Family somewhat anxious to revise that male-preference thing.
3 "Natural death: is an idea found in the British rules of succession (and likely those of other nations, although the British one is where I'm sourcing the phrase). To be "naturally dead" just means that you're not in line for succession. Under British succession law, for example, Catholics and illegitimate children are naturally dead.