One thing that some people end up asking themselves when the read or watch The Lord of the Rings for the first time is "what makes this Sauron guy such a big deal?" or "so what exactly is this Gandalf character?" The answer to that is that they are Ainur, which could basically be considered Angels created by Eru Ilúvatar. They are spiritual beings who were created from Ilúvatar's thoughts before the beginning of time, each having their own free will and varying levels of innate power. They sung the world into existence and shaped it afterwards, for good or bad. Some of them went into the world and were bound to it, these are the Maiar, and had physical forms that they used to interact with the world, though these forms could be destroyed and their spirits "disembodied," which is the closest thing to death a Maiar can experience. For the story timeline, see the Silmarillion, The Hobbit and Lord of the Rings articles in that order.
The strongest and most powerful Ainur to come to Arda and depending on how you look at them are either archangels or gods with a lower case g. There are thirteen in total, each one roughly corresponding to a particular "domain" analogous to Greek gods, though the Valar themselves do not claim to be deities of any sort (except for Melkor; more on him later). All the same, they're still highly respected by the Elves and Men of Dúnedain descent, and will oftentimes invoke their names in times of need.
The Valar ruled Arda from Valinor, aka the Undying Lands, from the beginning of time until the Second Age, when they relinquished control of Middle Earth to their creator Eru Ilúvatar, and Valinor became permanently separated from the rest of Arda.
- Manwë, King of the Valar and ruler over air and wind. Married to Varda, also Melkor's brother. The Great Eagles are Manwë's eyes and ears in Middle Earth. He is a very divisive character given the shit Morgoth (see below) gets up to to which his responses are either because of restrictions placed on him or because he is a lazy useless moron. Debate continues.
- Varda, Queen of the Valar and creator of the stars. Married to Manwë.
- Aulë, The Smith. Married to Yavanna, and creator of the Dwarves (though he could only create their form, Ilúvatar later gave them life and free will of their own). Both of his best disciples went traitor (Sauron and Saruman).
- Yavanna, Giver of Fruits. Married to Aulë. Besides her domain being nature, she also created the Ents to protect the trees from over-foresting dwarves.
- Mandos, Ruler of the Dead, and the Doomsman. All dead elves and men arrive in his halls, whereafter they go to their separate fates. He is also the judge of the Valar, presiding over Melkor's trial and pronouncing the Doom of those who transgress the Valar. Married to Vairë. His real name is actually Námo.
- Vairë, the Weaver. Married to Mandos, and records all of history on her ever-growing tapestry.
- Oromë, the Huntsman and Lord of the Forests. He was the first to discover the elves and invite them to live with the Valar in Valinor. Married to Vana.
- Vana, the Queen of Flowers, married to Oromë.
- Irmo, Master of Dreams, married to Estë. He would give prophetic dreams and visions to mortals in need. Together with his brother Mandos he is one of the Masters of the Souls.
- Estë, Lady of Rest & Healing. Elves who visit her and her husband's domain can recover from their weariness.
- Tulkas, Champion of the Valar, married to Nessa. He was the last to arrive in Arda, and was one of the few powerful enough to challenge Melkor at the height of his power, wrestling and imprisoning him with his own hands.
- Nessa, the Dancer, married to Tulkas.
- Ulmo, Lord of the seas, and the most proactive ally to the free peoples. One of the few to not trust Melkor in the beginning. As his home is not in Valinor but in the seas, he's the one who interacts the most with mortals.
- Nienna, Lady of Mercy, Grief and Compassion. She had been Gandalf's instructor, which allowed him to empathise with the free peoples, in particular the hobbits. Alongside Mandos, Irmo and Ulmo definitely the most competent of the bunch, given she was Gandalf's master and Gandalf basically carried the entire fight against Sauron on his back.
Of similar power but opposed to the Valar, is Melkor, aka Morgoth, the first Dark Lord and enemy of the Valar. Originally he was the most powerful of all the Ainur, but back during the music of the Ainur, he had become bitter that he could not create life on his own, and began rebelling against Eru Ilúvatar. Thereafter, he kept trying to dominate Arda to his will, corrupting it with his power and making war with the Children of Ilúvatar. Eventually, he'd spent enough of his power that he was captured and imprisoned by the Valar, only to be released when they thought he had been reformed. This was a ruse, and he continued to conquer Middle Earth throughout the first age, even causing the Noldor elves to rebel against the Valar just to get revenge on him. Melkor was finally defeated when the elves pleaded with the Valar to rescue them, causing him to be imprisoned beyond the boundaries of Arda until the end of time.
The lesser Maiar take many different forms throughout the series, though many served under each of the Valar at some point. In comparison to the Archangel-like Valar, Maiar are generally equivalent to lesser angels.
- Gandalf, Saruman, Radaghast, Rámostamó & Morinehtar : See Below.
- Eönwë: He is the banner-bearer and herald of Manwë, and shares the chiefdom of the Maiar along with Ilmarë. Eönwë was sent to Middle-Earth, at the end of the 1st Age, to lead the Host of the West against Morgoth, and it is said that it was he that overthrew that Ainu. After the War of Wrath, he went among the Númenóreans and, with the authority of the Powers and Eru, blessed that people with longer lifespan, taught them crafts and lore and brought flora and fauna from Valinor (including a seedling of the White Tree). It is prophesied that, when Morgoth returns to destroy Arda, Eönwë and Túrin Turambar will slay him forever.
- Ilmarë: She is the handmaiden of Varda and, as said before, a chief of the Maiar. Unlike Melian, she remain in Valinor in content and nothing more is known about her.
- Melian: Noteworthy for being the progenitor of both the Half-Elves and the Kings of Gondor, she married the Elven king of Doriath and bore Lúthien, who would herself marry a human named Beren. As this shows, it was possible for Maiar in their physical forms to procreate with the Children of Ilúvatar, which has some interesting implications (and potentially disturbing ones, see 'Boldogs' below). She protected Doriath with her magic until her husband was killed by a bunch of angry Dwarves, and eventually returned to Valinor heartbroken.
- Sauron: Most powerful of the Maiar. Formerly a student of Aulë but later was swayed to Morgoth's side. He is ever so slightly less of a dick than Morgoth, which still left a lot of room for satanic-tier dickishness. While Morgoth wanted to destroy the world and recreate it from scratch in his image, Sauron wanted to Dominate it and shape its peoples and societies into his own "idealized" (read:hellish) image. Whereas Morgoth used brute strength to impose his will, Sauron favoured guile and manipulation, especially when he successfully corrupted the kingdom of Númenor and brought about its ruin, or when he used his Ring to dominate the wills of others. He's taken on other guises as well; such as "Annatar the Lord of Gifts" to deceive the Elves of the Second Age, or the Necromancer of Dol Guldur when he was in hiding. Sauron poured practically all of his power into his ring, which not only prevented his power from fading (as it did with Morgoth), but also allowed him to survive his initial disembodiment until the War of the Ring, when the destruction of it robbed him of all his power and reduced him to an angry and completely-powerless ghost floating through space.
- Balrogs: Balrogs are greater Maiar who sided with Morgoth and took the form of fiery demons. The one in the Fellowship of the Ring, Durin's Bane, is one of the last remaining ones; Morgoth used to field armies of these guys.
- Gothmog: Lord of the Balrogs, killed in the Fall of Gondolin when Ecthelion of the Fountain charged him and they both drowned in the gigantic pools of the city.
- In the Third Age, an Orc/Black Númenórean/SOMETHING adopted Gothmog's name for themselves and served as the lieutenant of Minas Morgul and second-in-command to the Witch-king. They were present at the Siege of Minas Tirith, but their fate after that is completely unknown. Aside from this, nothing is known about them. In the movies, Gothmog was portrayed as a Orc General with a hideously misshapen face and tumor-like deformities all along the left side of his body.
- Gothmog: Lord of the Balrogs, killed in the Fall of Gondolin when Ecthelion of the Fountain charged him and they both drowned in the gigantic pools of the city.
- Boldogs/"Orc-shaped Maiar": Lesser Maiar who were seduced to Morgoth's side, but instead of taking the shapes of fiery demons like the Balrogs, they took the forms of Orcs. Although less powerful than the Balrogs, these creatures were still powerful and were usually in command of Morgoth's many armies. Earlier versions of Tolkien's legendarium did not have a name for these types of creatures, and Boldog was instead the name of an Orc Chieftain killed by Thingol. Later versions removed this character and suggested in a footnote that instead it was a title or species-type for "Orc-formed Maiar", which suggests that Tolkien never got around to finalising this concept alongside the exact origin and nature of Orcs. Their presence within the lore however, could have been the set-up for one of Tolkien's many abandoned attempts at explaining the origins and evil nature of Orcs, for making them the rape-spawn of these aforementioned fantasy Fallen Angels would certainly explain just why the Orcs are so demonically twisted in both flesh and spirit; but like the many other attempts at an answer for the Orcish question, the good professor likely abandoned the idea early on due to the many uncomfortable implications of the idea and questions of faith it brought up within himself regarding how someone can possibly be born already predestined to be evil.
- Arien & Tilion: these two became the bearers of the Sun and Moon, which were the last fruit & flower of the Two Trees of Light that Morgoth killed. Arien was one of the fire spirits that Morgoth couldn’t sway to his service, and she is said to be the second most powerful Maiar. Tilion is not as powerful, and more reckless, resulting in the phases of the moon and eclipses. He is said to be the Man in the Moon and Arien’s lover.
The Istari is the formal name of the Wizards, all of whom were Maiar who were sent to Middle Earth to aid the free peoples and provide them with wise counsel during the Third Age between Sauron's initial defeat and his final one. Though they appear to take the form of elderly men, they're still quite powerful in their own right, both physically and magically. There are five of them in total. In order of power and rank they are Curumo (Saruman), Aiwendil (Radagast), Alatar/Morinehtar and Pallando/Rómestámo (the Blue Wizards), and lastly Olórin (Gandalf).
They were sent by Manwë to inform mortals about Morgoth's lieutenant Sauron and raise forces amongst the Free Peoples to oppose him, they were however restricted from directly leading them or otherwise doing all the fighting, as there was the (justified in hindsight) fear that they could fall just like Sauron did and desire to dominate and rule Middle Earth instead of liberating it. Readers only learn to what happened to three of them.
Saruman the White: was corrupted after learning about the nature of the rings of power and its ruling ring, and fell completely after gazing into the Palantir of Orthanc and being subdued by Sauron. Saruman coveted the One Ring and desired to find and take it for himself, and being a Maiar of the same level as Sauron, could have theoretically been able to successfully exploit the One Ring and claim its power for himself, thus becoming a new Dark Lord. At some point, Saruman casts aside his title of 'the White' in favour of becoming Saruman of Many Colours as a show of dominance and mastery. Saruman's treason and ultimate defeat is of course the first half of the plot of the whole series. The nature of his death and defeat differs between the books and film. In the films he perishes during the final confrontation at the Orthanc, being stabbed in the back by a vengeful Grima Wormtongue. In the books he survives until the very end of the story, where he tries to take a petty revenge upon the hobbits of the Shire by taking it over with a bunch of criminals and... industrialising it. The Hobbits overthrow his mafia-regime, and after abusing Grima Wormtongue one final time, gets his throat slit by the fed-up lackey.
Some time before (or after, if you're a film scrub) the events of the Hobbit, Radagast the Brown: lost sight of his purpose as a Wizard of the order, and instead became infatuated with Nature and its wild animals, likely falling to his own inborn callings and affinities as a Maia of Yavanna, the Vala of Nature. Despite losing track of his true mission, Radagast never completely abandoned it, and still served as a messenger for Saruman and did train birds to assist both Saruman and Gandalf, even if in those purposes he served as a cat's paw for the traitorous Saruman. It could also be said that by focusing on the natural world, Radagast still aided the Free Peoples by defending Nature against the industrial depredations of The Enemy.
Gandalf the Grey: was the most proactive, counselling Elves, Dwarves and men. He was responsible for the events of The Hobbit, which saw the northern Orc armies and Smaug, the last dragon of any real strength, dead. He initially led the Fellowship until he was pulled down to the bottom of dwarf mines of Khazad-dûm by the Balrog, Durin's Bane. Fought and chased the bastard up the Endless Stair for days, and died after killing it, with the duel itself destroying Durin's Tower at the top of the peak. He was then upgraded to Gandalf the White by Eru Ilúvatar and was given a ride back to the action by the Eagle Gwaihir the Windlord (the lord of the Giant Eagles), thus rejoining the Fellowship. He fucked off to the Undying Lands after the War of the Ring as retirement is the only thing you can do after the defeat of the BBEG. Also had some pretty cool gear with him, such as his sword Glamdring, the Elven Ring of Fire: Narya, and a Wizard Staff he often dual-wielded with Glamdring. The latter being upgraded when he became the White Wizard in the place of Saruman.
As for the two Blue Wizards:, we're only given scraps of speculative information. All we know for sure is that they headed East and South into the lands where Sauron held sway. One version says that they ultimately failed in their mission or even became wayward, possibly creating cults of magic. Another, however, says that they were successful in creating uprisings and occupying the vast forces of the East and South, preventing those forces from coming to the aid of Sauron in the War of the Ring. Regardless of whether the Blues succeeded or failed, they and Radagast likely returned to Aman as well.
- Tom Bombadil: Exists specifically to fuck up neat and tidy classification systems. (Distant sound of Professor Tolkien's Ghost laughing).
- Ungoliant: Her exact nature is unclear, save for the cryptic note that she existed before Arda and came into it early on, which implies a lot. The mother of Shelob the giant spider, Ungoliant herself was an even more massive spider monster who was the progenitor of all other giant spiders in the world. Not that she was a good mother, she only gave birth to other spiders to have something to eat and studs to breed new spiderlings with before devouring. Her ultimate drive was an insatiable hunger and a contempt for everything else that lived. Ungoliant hated the light but also gained power from consuming it, so she temporarily allied with Morgoth to destroy the Two Trees of Light. When their alliance was dissolved, she nearly killed Melkor for trying to hide the Silmarils from her, but his Balrogs had to come in and save him. She eventually became so hungry that she ate herself.