He did eventually (after some years: remember that Gollum has a hatred and fear of the Sun, the Moon and other creatures, so it took some time) leave the Misty Mountains in pursuit of Bilbo Baggins, but was eventually drawn south, towards Mordor, because all evil was being drawn to Mordor, at the time. This is how he discovered the secret stair by Minas Morgul, and how he encountered Shelob.
This is all described in a chapter of the first book in Tolkien's The Lord of the Rings book series called "Shadow of the Past"
What is more, he knew where he came from.’
‘But how did he find that out?’ asked Frodo.
‘Well, as for the name, Bilbo very foolishly told Gollum
himself; and after that it would not be difficult to discover
his country, once Gollum came out. 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.
[...]
‘Light, light of Sun and Moon, he still feared and hated,
and he always will, I think; but he was cunning. He found he
could hide from daylight and moonshine, and make his way
swiftly and softly by dead of night with his pale cold eyes,
and catch small frightened or unwary things. He grew
stronger and bolder with new food and new air.
—The Fellowship of the Ring: The Lord of the Rings, Part 1, Chapter II,
"The Shadow of the Past"
At some point during this travel, he was captured and taken to Barad-dur, where he was tortured and forced to reveal to Sauron the two words "Shire" and "Baggins".
Frodo asks the same question you do:
‘Then why didn’t he track Bilbo further?’ asked Frodo.
‘Why didn’t he come to the Shire?’
‘Ah,’ said Gandalf, ‘now we come to it. I think Gollum
tried to. He set out and came back westward, as far as the
Great River. But then he turned aside. He was not daunted
by the distance, I am sure. No, something else drew him away
[...]
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.’
[...]
‘Yes, to Mordor,’ said Gandalf. ‘Alas! Mordor draws all
wicked things, and the Dark Power was bending all its will to
gather them there. The Ring of the Enemy would leave its
mark, too, leave him open to the summons. And all folk were
whispering then of the new Shadow in the South, and its
hatred of the West. There were his fine new friends, who
would help him in his revenge!
—The Fellowship of the Ring: The Lord of the Rings, Part 1, Chapter II,
"The Shadow of the Past"
We know all this because Aragorn captured Gollum, at the request of Gandalf (Gandalf asks this of Aragorn shortly after Bilbo's birthday feast) and Gollum confessed to all of this, and Gandalf, with his divine knowledge, did a lot of deduction.
By the time Gollum was released and he resumed his pursuit, the ring had already left The Shire in the hands of Frodo, who was being escorted as a member of The Fellowship. That's why, in the movies, we meet Gollum tailing the fellowship in Moria, which prompts the following scene and dialogue:
FRODO
(whispers)
There's something down there.
GANDALF
(quietly)
It's Gollum.
FRODO
Gollum!
GANDALF
He's been following us for three days.
TEASING SHOT: and emaciated, leering creature.
FRODO
(disbelieving)
He escaped the dungeons of Barad- dur?
GANDALF
Escaped...or was set loose. And now the
Ring has drawn him here...he will never
be rid of his need for it. He hates and
loves the ring, as he hates and loves
himself. Smeagol's life is a sad story.
A book answer is necessary to answer this question because the movie insufficiently explains Gollum's actions between The Hobbit and The Lord of the Rings with a single line in the chapter of the movie The Lord of the Rings: The Fellowship of the Ring (2001) of the same name ("Shadow of the Past").
FRODO
(thinking fast)
We put it away, we keep it hidden! We
never speak of it again. No one know
it's here, do they?
Gandalf shifts uncomfortably.
FRODO (CONT'D)
Do they, Gandalf?
Gandalf looks at Frodo, sadly...
GANDALF
There is one other who knew that Bilbo
had the Ring. I looked everywhere for
the creature Gollum, but the enemy found
him first.
This line serves as enough exposition to let us, the audience, know about their immediate danger, that Gandalf went looking for Gollum but that the enemy found him first, which is good enough information for the story being told in the movie, but not enough to explain in detail what happened to Gollum between The Hobbit and The Lord of the Rings - we need the books to fill that gap. Since the Lord of the Rings movie trilogy, from the characters down to the dialogue, is a pretty faithful adaptation of the books, it makes sense to use the book as a reliable source of further information that the movies don't provide.
‘But how did he find that out?’ asked Frodo. ‘Well, as for the name, Bilbo very foolishly told Gollum himself; and after that it would not be difficult to discover his country, once Gollum came out.