Well, first I’m answering here from Tolkien’s writings, not the movie adaptations. I’d say Tom Bombadil, not sure whether you call him powerful in the sense of Sauron, but in the sense that he is totally fearless and is also the oldest creature we meet there, and even the Ring has absolutely no power over him, he treats it as a trinket. Says he has the same kind of strength the Earth itself has. If you rank the beings by power you have to leave him out of that ranking. He is neither at the top nor the bottom but just not interested and nobody else has power over him.
It’s a great shame that he was left out of the movies as he gives a new perspective on the ring. For him it is just a trinket that he would soon forget if it was entrusted to him, probably just drop it somewhere and forget he had it.
The Ents have a kind of relentless power, like that of trees or plants. Takes a lot to stir them up but if they get stirred up then hard to resist though they can be destroyed by fire.
Gandalf has a hidden veiled power. He seldom uses it which is why he seems like a simple wizard. You only really see it in his fight with the Balrog. He’s been tasked with using more subtle methods and to display his power only when he absolutely has to. He is bearer of one of the rings of power, Narya given it by Cirdan of the gray havens.
The hobbits themselves have a certain resilience that makes them much stronger than you’d expect a bit like Tom Bombadil in some ways, a resilience that comes from their closeness to the Earth. They can carry the ring for years, and not be affected by it.
Men are amongst the weakest when it comes to the ring, but they are brave in battle, and the kings like Aragorn have a certain strength to them, and as well as strength in battle, he has “the hands of a healer” which we see first when he helps counteract some of the effects on Frodo of his wound from the black rider, enough for him to continue to Rivendel .
Galadriel has a magical strength to her a confidence, and groundedness. She has a magic of healing, of preserving against corruption and decay, of healing and regeneration, and able to hide her thought from Sauron. She’s bearer of Nenya
Elrond and the higher elves have immense powers that come from their presence in the other realm, similar to the way the black riders are in both this world and another realm, but bright, like a very bright light shining from them if you could see their true nature. Elrond is the bearer of Vilya. Glorfindel is also mentioned as an elf of great power.
They are also immortal.
Arwen is half elven which is why she had the option to choose whether to die like a mortal human or to stay as an elf and live for ever or at least to the end of this world system.
As for beings we don’t meet but hear of directly, Varda who the high elves sing to when the hobbits first meet them in book 1 of LOR, also known as Elbereth or Gilthoniel is one of the beings that helped to sing our world into being, the Valar. She is particularly associated with stars, she scattered them into the sky.
Eru Ilúvatar is a bit like the Christian God but not exactly because he doesn’t create the world by himself, it comes into being as a result of a song sung by the Valar. He doesn’t appear in the LOR or Hobbit at all.
So, I’d say those are amongst the most powerful beings we meet. Sauron isn’t really that powerful a figure, intrinsically, he’s on a similar level to Gandalf and Saruman, Sauron, he got his power through deceit and study of dark magic and such like. They are all Maiar while Sauron’s master Melkor was one of the fifteen Ainur who helped sing the world into being.
This is the story of the singing into being of the world. It’s at the core of Tolkein’s thinking Music of the Ainur
What Tom Bombadill is is never made clear. He doesn’t seem to fit any of those categories. Some say he is a Maiar but that doesn’t seem convincing, why would he not be susceptible to the ring and how could he call himself oldest? He can’t be an Ainur as they are all named although when he calls himself the oldest, that makes him sound like one of them. I think he is included partly so that we don’t think of the LOR as cut and dried with everything explained to us, so that some of it is still mysterious.
Then we have the Dragons. They are very powerful but at the time of the LOR they have lost their power and indeed may even be extinct after the death of Smaug at least the great dragons though smaller cousins may have survived until later. The most powerful of the dragons could destroy rings of power with their fire, though none of them were powerful enough to destroy the One Ring.
The Balrog’s are basically fallen Maiar similar in power to Gandalf and Saruman and Sauron. When Gandalf struggled with the Balrog then he was in a more or less equally matched struggle with him which is why it went on so long and was so exhausting for him.
The Army of the Dead are just ghosts, and most of their power came through instilling fear.
The orcs and trolls don’t have any special powers, are just physically strong and the trolls are huge.
The Great Eagles are somewhat magical as well, mainly, they fly high, can see far and are wise. But they are vulnerable to arrows.
The black riders are just humans who have had magic rings for so long they no longer have much substance in this world. Their main power is fear and despair. They are not really physically that strong and they also are not very confident when they encounter just the hobbits plus Aragorn many miles away from Mordor. And after all they are basically unwilling slaves originally that Sauron has bent to his wishes.
When they encounter him on Weathertop, they prefer to just wound Frodo and wait for him to succumb. Many say this is a plot weakness but I think myself it perfectly captures what they are like, their basic cowardness behind all the fear they instill in others.
But become much more terrifying and stronger when surrounded by armies, they get their strength and confidence I think from the presence of others around them that they dominate, mainly through fear and despair. Intrinsically they aren’t very powerful - they could be but are kind of conflicted. And basically are humans with rings, not Maiar like Sauron, Saruman, or Gandalf.
Their flying mounts are basically a kind of pterosaur type creature, a flying dinosaur like creature. They are mainly just strong and with the power of flight but capable of being killed.
The hobbits have the advantage of being able to move very quietly and easily stay hidden.
Shadowfax also is a creature of power, able to run faster than the wind.
I know I’ve left out many of the characters, but that’s a summary of some of them. So it’s not really a linear ranking, rather that they all have different capabilities.
And the story is about how the hobbits, in many ways feeble and insignificant creatures, who even got left out of the old lists of the living creatures on middle Earth somehow manage to finish this quest to destroy the ring, but are only able to do it through all the other beings they meet who assist them in many ways at crucial points. And they succeed partly because they are so insignificant, tiny, easily ignored that Sauron gives them very little attention. A direct onslaught of him would probably never have succeeded even if all the “free people” banded together to try to defeat him.
So - in the book anyway - it’s about showing how it’s not necessarily through power that you achieve things and even the very weak and feeble sometimes have their role to play and can be the pivot of everything, through no choice or plan of their own.
And it’s about staying true to your purpose, even when it seems there is no hope of success.
Hope that helps.