In the book there was no reference to this because the Necromancer was a much less important character and his machinations were just a convenient way for Tolkein of tying up Gandalf so that he wouldn't be able to help Thorin & Co through Mirkwood or with Smaug and so that Bilbo could grow as a character. At some point in the novels (I think one of the LOTR books) I believe it's suggested that Gandalf instigated the quest with the hope of using the Dwarves to kill Smaug because he realized that dark forces were gathering and it would behoove him to preemptively take out one of their potential weapons before said dark forces made their move.
In the movie canon, presumably Sauron/Necromancer is communicating with Smaug telepathically, or else he has some kind of cosmic awareness.
Originally posted by ares834
In he extended edition it's clarified that Sauron and Smaug are in an alliance. Which, incidentally, is what Gandalf sought to prevent.