
This is an extremely crazy idea I got. Don't take it seriously.
When Frodo was wounded by the Morgul blade on Weathertop, he was in danger of turning into a shadow, serving Sauron forever. Only the combination of Aragorn's healing skills with Athelas and the magic of Elrond's House could save him. Or could they?! Why would Tolkien mention this Morgul magic if it would have no effect in the end? What if Frodo was in fact turned into a shadow but nobody noticed it because the evil magic was hidden too good?
The new born Shadow-Frodo always planned to betray the Fellowship and to give the Ring to Sauron. Boromir got it absolutely right when he accused Frodo of betrayal on the Amon Hen. Shadow-Frodo only split from the Fellowship to be able to go for his evil plans. That's why he ran from everyone, even from Sam. Unfortunately, the little good left in Frodo made him save Sam and would prevent him from doing him any harm.
Later, on the stairs at Cirith Ungol, that changed. Shadow-Frodo could finally find a way to make Good-Frodo believe, Sam was evil, thanks to Gollum. But was Gollum evil? No. To explain his situation, let me correct his backstory.
When Deagol found the Ring in the Anduin, his cousin Smeagol directly understood what it was (don't ask me how he knew^^) and that it had to be destroyed in Mount Doom. But Deagol wanted to keep the Ring, because he was already obsessed by it. In the end, the only thing Smeagol could do to save the world was to kill his own cousin to take the Ring and find a way to destroy it.
But Mordor was too dangerous; going there with the Ring would have a too high risk of loosing the Ring to Sauron, and that's the worst thing that could happen. So Smeagol continued to hide from everyone, not even trusting his own family. He used the powers of the Ring to kill many orcs, servants of Sauron. When Frodo stole the Ring, risking the fate of the world, Smeagol had to get it back. But he also used the opportunity to scout out the way to Mordor - with fatal consequences.
Gandalf knew Smeagol's true story, and so he always left him alive. Later he secretly commanded the elves to let him free, but concealed it with lies. Gandalf's calculation was correct, and while Shadow-Frodo slipped away from the attention of the Fellowship, Gollum sneaked after him; and Gollum was in the end the one to destroy the One Ring and prevent Shadow-Frodo from offering it to Sauron, on the cost of Gollum's own life.