How is Smaug aware of the fact that there is a war coming when all he has done is lie amongst the gold that he stole from the dwarves at Erebor?
He mentions that there is a war coming but how would he know this?
There's some evidence that that is not all he did; see my answer at What did Smaug eat for 60 years?, for example.
Even so, Tolkien doesn't need to explicitly describe Smaug coming out from time to time in order for us to accept that he does come out. He doesn't explicitly describe Aragorn going to the toilet, for example, but yet we can accept that Aragorn does do so. Why shouldn't we accept that Smaug likewise comes out to get news and food too?
Within the movie continuity, it is possible that Sauron has already sent one or more of the Nazgûl to try and recruit Smaug. This may be revealed in the last film. It makes sense story wise to do this in order to make the possibility that Sauron will use Smaug as a weapon an even more present danger. This makes defeating him a greater priority because if they fail he could move on to join Sauron.
It's worth noting that that's specific to the movie. In the book, Smaug never mentions war coming, though he does gloat about how good he is at killing people when he feels like it. The bit about him mentioning a coming war is a fabrication of Peter Jackson as part of bringing the Hobbit more in line with the LOTR and making it more serious in tone.
Gandalf's stated motivation in the Hobbit movies is to take out Smaug so that he can't be recruited to Sauron's side in the War of the Ring. This is nowhere to be found in the Hobbit--however, it is a central feature in the Quest of Erebor, which Tolkien wrote specifically to bridge the Hobbit and LOTR. In it, Gandalf says:
I knew that [Sauron] was planning a great war, and I surveyed all the lands in my mind. The urgent question was: which would he do first? Try to re-occupy Mordor; or attack the small but powerful strongholds of his chief enemies, Lórien and Rivendell?
I felt sure that he meant to attack them; it would have been the better move for him.... He need only re-occupy the old realm of Angmar.... Smaug he might use with terrible effect.
So we see where the Hobbit movies get the subplot of Sauron's reoccupation of Angmar, and even that last sentence which is repeated almost verbatim in the movie. So what Gandalf said there wasn't in the Hobbit, but was in Tolkien's writings, very nice! But this is where all the talk of an impending war comes from in the Hobbit movies: the Quest of Erebor, which is certainly canon for Middle Earth. Still, nowhere did Tolkien ever suggest that Smaug knew that war was coming, though it's not in direct contradiction to his writings either.
Now within the confines of the movie, we could suppose that Smaug probably had word of a coming war from some source--servants of Sauron might have passed through the Lonely Mountain on their way to or from Gundabad, or he might have received messengers from Sauron himself.
I just took it for granted that Smaug listened in on the affairs of Middle Earth from time to time, or that he was telepathic in some way or are he just had extreme insight. He was a dragon after all.
Also it's my belief that we should be careful to make sure for specifying the film or the book. Since continuity in films based on books always change for the sake of entertainment
We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.