Bilbo was able to take the ring because Gollum had taken it off.
If you had the ring, and were accustomed to wearing it, why would you ever take it off anyway?
The ring was capable of taking indirect action on its own.
The Ring also caused those who possessed it to become obsessed with it, so much so that they might kill anyone who showed too much interest in it or attempted to touch the Ring. With an evil will of its own, the Ring would make attempts to return to its Master. It could "call out" subliminally to other persons, in an attempt to get them to pick it up or possibly kill the current owner. It was also capable of slipping unnoticed from the owner's finger, leaving him vulnerable to attack or to gain a new owner that would help get the Ring back to Sauron. Frodo Baggins was warned by Bilbo that the Ring tended to "slip away" at odd times, and compensated for this by wearing it on a chain around his neck.
As such, it is likely that the Ring left Gollum, sensing Sauron's return to power. As the caves were filled with goblins, trolls, and orcs, it likely expected to be picked up by one of them at which time it could begin moving back to its Master.
I just read that passage last night; re-reading the story with my son.
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. He might even venture into places where the torches were lit and made his eyes blink and smart; for he would be safe. Oh yes, quite safe. No one would see him, no one would notice him, till he had his fingers on their throat. Only a few hours ago he had worn it, and caught a small goblin-imp.
Emphasis added on the last line - he didn't often wear it anymore, but had just gone out with it to hunt, which is the reason the ring could be found laying in the tunnel when Bilbo came along.
From this answer:
if [a mortal] often uses the Ring to make himself invisible, he fades: he becomes in the end invisible permanently, and walks in the twilight under the eye of the dark power that rules the Rings.
So wearing the ring can wear you out.
Something Peter Jackson brought to the films, which I'm not sure was very prevalent in the books, is that the Ringworld, what you see while you're invisible, is not a very pleasant view of the world, and not a place you want to be for long periods. The effects used in the film to show the Ringworld were meant to be an answer to this obvious "audience question".
Also, while the Ring is being worn, and the bearer is using its power, the Nazghul and other servants of Sauron can sense its presence more keenly. If it's in your interest to keep the Ring secret, then you don't want to be wearing it for long periods or you'll lead the baddies right to you.
I am assuming that this was a joke/comic insight...and it was pretty funny :)
Maybe, since he couldn't die while he had the ring...and since he couldn't live without having a little "good" left in him (his soul--a sort of Socratic view of the soul), the natural effect was a bifurcation of his personality...the good side that wept and cried in the darkness, Smeagol...and the dark, obsessive side enraptured with the ring, Gollum.
In order to survive, he relied on Gollum...in order to live, he separated from the ring so that Smeagol could exist. Anyways, that's my theory. Makes sense when you think about why a starving, corrupt creature would agree to play a game of riddles with a plump, helpless hobbit. Or later save Frodo's life while, at the same time, planning his death (the climb to the spider's lair, I think...I'll have to double check).
So...now that I put some of the basics down...
Gollum might be a duality: Smeagol and Gollum. According to Socrates (my philosophy 101 class) you must have a soul to be alive.
The ring possesses Sauron's soul, which, apparently, is immortal. It follows that Sauron's soul possesses the ability to grant those souls around it temporary immortality as well. However, one does not need to actually wear the ring to be immortal.
Next, when one puts on the ring, one becomes invisible: truly invisible. Recall that Gandalf mentions that true invisibility is basically non-existent in his thousands of years of experience on the earth (first book of LOTR, I believe).
Now consider this: why does the ring extend the immortality of Sauron's soul to the bearer, but fail to actually turn the bearer himself Into Sauron? Ie, a Sauron ghola.
Perhaps this is where the soul comes into play: Since one must have, according to Socrates, a soul to exist...and since all souls are created equal (like charge-positive, negative), then when one piles Sauron's inanimate soul (bound to a ring) on top of an animated soul (a living body), the two neutralize eachother, which manifests in the form of "true" invisibility.
So...since Smeagol exists for 600+ years bearing the ring without turning into Sauron, I think that his continued existence (and, therefore Sauron's) is dependent on him not always wearing the ring...so the ring must slip off of his hand in order to protect itself, lest they both disappear into the wraith-world, and Sauron's tie to the Mortal plane disappear forever.
Anyways, I am pretty sure that is the gist of it: either it is Smeagol reacting to preserve himself and survive, or it is Sauron's soul leeching as much life from it's host without killing them both...Either way, I bet that, in Tolkein's microcosm, neither the ring nor the bearer can survive if they are joined forever. Or maybe its just a hassle to walk up stairs when you can't see your feet. I don't know.
LOL. I feel like a kid again :)
Gandalf answers this clearly and explicitly:
'There was more than one power at work, Frodo. 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 Déagol, 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. Only to be picked up by the most unlikely person imaginable: Bilbo from the Shire!
'Behind that there was something else at work, beyond any design of the Ring-maker. I can put it no plainer than by saying that Bilbo was meant to find the Ring, and not by its maker. In which case you also were meant to have it. And that maybe an encouraging thought.'
Note that Gandalf sees two entities at work here: the Ring, desiring to get back to its Master, and "something else" "beyond any design of the Ring-maker" Who meant Bilbo to get the Ring.
Gollum didn't leave the Ring, the Ring left Gollum.
But the Ring's evil purposes in finding a new owner were taken by Iluvatar and turned to its despite:
Then Iluvatar spoke, and he said '...For he that attempteth this [Evil] shall prove but mine instrument in the devising of things more wonderful, which he himself hath not imagined.'