He's been hiding under a mountain for years, and when he wasn't hiding under a mountain, he was stalking the Fellowship. The point is that his activities would not put him in contact with people who would know Sauron's plans.
Bilbo was only 50 when he left on his quest. He turns 51 while riding in the barrel, so he's 51 when he arrives in Esgaroth, on Long Lake.
Bilbo then keeps the ring until his 111th birthday, when he (quite reluctantly) leaves it to Frodo. Frodo and Bilbo shared the same birthday, so Frodo turned 33 when he received the ring.
Then Frodo has the ring for some time. He's 50 when Gandalf returns and puts it in the fire to confirm its true identity.
So, there's approximately 77 years from when Bilbo first got the ring, until Gandalf reveals to Frodo what the ring really is.
So what did Gollum do during that time? He remained in the mountains for a little of it, but only a little. Toward the beginning of The Fellowship, Gandalf says:
Oh yes, he came out. His longing for the Ring proved stronger than his fear of the orcs, or even of the light. After a year or two, he left the mountains.
So, Gollum had around 75 years to travel around middle earth, gather news and try to find Bilbo:
'[...] He found his way into Mirkwood, as one would expect.'
'Is that where you found him?' asked Frodo.
'I saw him there', answered Gandalf, 'but before that he had wandered far, following Bilbo's trail.'
'[...] from hints dropped among the snarls I even gathered this his padding feet had taken him at least to Esgaroth, and even to the streets of Dale, listening secretly and peering.'
'[...] But at last, when I had given up the chase and turned to other parts, Gollum was found. My friend [Aragorn] returned out of great perils bringing the miserable creature with him.'
"What he had been doing he would not say. He only wept and called us cruel, with many a gollum in his throat; and when we pressed him, he whined and cringed, and rubbed his long hands, as if he remembered some old torture. But I am afraid there is no possible doubt he had made his slow, sneaking way, step by step, mile by mile, south, down at last to the land of Mordor."
Gollum/Smeagol has had around 75 years to gather news of the ring, Mordor, and Sauron (and chase after Bilbo)--and he's made use of that time, traveling all over middle earth and gathering news. Further, his long association with the ring draws him to the parts of middle earth such as Mirkwood and Mordor that are closely associated with Sauron, leading to a considerable amount of information about Sauron and his intentions.