Your question is answered by Gandalf to Frodo at the beginning of LotR, in chapter 2, "Shadow of the Past":
Quote:
A Ring of Power looks after itself, Frodo. It may slip off treacherously, but its keeper never abandons it. (...) It was not Gollum, Frodo, but the Ring itself that decided things. The Ring
left him.
(...) "The Ring was trying to get back to its master. It had slipped from Isildur's hand and betrayed him; then when a chance came it caught poor Deal, and he was murdered; and after that Gollum, and it had devoured him. It could make no further use of him: he was too small and mean; and as long as it stayed with him he would never leave his deep pool again. So now, when its master was awake once more and sending out his dark thought from Mirkwood, it abandoned Gollum."
|
The same thing happened to Isildur: he was swimming with the Ring on, and surely he handled the Ring with great care, because in contrary to Gollum, he even knew what he's actually holding! Nevertheless, suddenly he realized the Ring is just gone. The same must have happened to Gollum.
(Just to note, the point of the passage from which I picked quotes above is about something else, but for our needs I picked these to explain the Ring's leaving of Gollum.)
Also, to explain more of how Gollum handled the Ring, a quote from the Hobbit:
Quote:
Gollum used to wear it at first, till it tired him; and then he kept it in a pouch next his skin, till it galled him; and now usually he hid it in a hole in the rock on his island, and was always going back to look at it. And still sometimes he put it on, when he could not bear to be parted from it any longer, or when he was very, very, hungry, and tired of fish. Then he would creep along dark passages looking for stray goblins.
|
With this corresponds also another word of Gandalf's from the Shadow of the Past:
Quote:
For it was long since he had worn it much: in the black darkness it was seldom needed.
|