explanation in a letter he wrote to a fan who expressed her concern to him that Frodo was a failure. I'll link a great summary of the letter below, but share a couple quotes from it as well:
Simple minds would see Frodo as a "failure" for not having endured to the end. Tolkien did not disdain "simple minds" for they often see clearly simple truths and absolute ideals, but their views contained weaknesses. They missed the complexity of situations involving an absolute ideal and tend to forget that strange element called Pity or Mercy, which is also an absolute requirement in moral judgement....Frodo's was not a moral failure. In the Cracks of Doom the Ring's pressure reached its maximum upon Frodo, after long possession, months of torment, starvation, and exhaustion. He had done what he could, spent himself completely, and produced a situation in which the object of his quest could be achieved. His humility, sufferings, and patience and mercy towards Gollum were rewarded: his failure was redressed.
Tolkien stated that we are creatures with absolute limits upon our powers of action or endurance. Moral failure only occurs when effort or endurance falls short of the limits, and blame decreasing the closer the limits are approached. Frodo did receive "grace", the enhancement of his power by Providence, but even grace is limited. It can be observed, Tolkien thought, that some individuals seemed to be placed in "sacrificial" positions wherein the solution demands powers beyond utmost limits.