Interestingly, I feel that there is another layer to this, and that is Frodoās mercy (mirroringĀ āthe pity of Bilboā which Gandalf said would prove significant) at play, tangled up in his use of the Ring and the chain of events that would play out.
Frodo is sparing Gollumās lifeĀ here, and shaping that into his curse. He is only cursing GollumācanĀ only curse Gollumāas an effect of this mercy; if Gollum were dead, he could not be cursed by Frodo or the Ring; his survival makes the curse possible and serves as payment for the curse: they are in effect making a bargain here, wherein Golllumās life and his sentence of dying in the Fires of Doom should he take the Ring again are as one, a package deal, which GollumĀ āacceptsā by retreating with his life.
Then, once Frodo comes to Mount Doom, he cannot cast the ring into the fires; the Ring has him in thrall, since he has used it. Now into the picture again comes Gollum, whose greed for the Ring has surpassed his love of his own lifeāeven having been cursed with death should he touch it again, he craves it and demands it for himself, taking it from Frodo by force.
ThusĀ we see the Ringās power divided against itselfāit has defeated both Frodo and Gollum, and its defeat of Gollum inspires Gollum to fight Frodo for it, invoking the curse. And thus Sauron, who hasĀ it, now, by virtue of both its erstwhile Bearers falling under its (and therefore its Lordās) sway, is cheated out of it by the effects of Frodoās act of mercy.
Frodo spared Gollum, and used the Ringās power to set a curse, and when Frodo faltered, it was Gollum whom he spared who took the Ring from him and invoked that curse, falling into the Fires of Doom and, due to the same greed that defeated Frodo, taking the Ring with him.
If there had been no sparing Gollum, there would have been no curse, and Frodo would have had the task Isildur failed atādestroying the (beautiful, useful, lovelyĀ ring)āset before him alone, and he may have succeeded, or he may have failed, or he may have tarried too long in the struggle for Sauronās destruction to come in a timely fashion, or the resolution and the Ringās destruction may have hurt him far beyond the loss of a finger.
Instead, there was Gollum, in thrall to Sauron yet doomed by Frodo, to take from Frodo both the Ring and the burden of destroying it. Frodo, in his mercy-tinged use of the Ring, effectively shifted the impetus behind the Ringās destruction from himself to the doom laid on Gollumāand Sauronās hold over Gollum made it a near certainty that the doom would come to pass: Gollum would die, and not surrender the Ring, and thus the Ring would fall with him into the fires of Mount Doom.
And Frodo ⦠like Indiana Jones in the Chapel of the Holy Grail, could avoid falling himself by either a willingness to let go, or the presence of a loved one to hold him back. Or, yāknow, Gollum deciding to bite rather than just grab. A few more options here.