Of Ainur Valar and Maiar
In the beginning the Creator (Ilúvatar) and the Ainur, who were the offspring of Ilúvatar's mind, envisioned the world through what Tolkien calls the "Music of the Ainur". And of course one of them - poor Melko, who else - couldn't keep the tune and sang out of tune - probably some weird rap or something: but it was loud and vain and endlessly repeated... - and good old Eru (that was Ilúvatar's nickname) at first only raised an eyebrow at Melkor, but Melkor - stubborn and having a few temper tantra - still refused to learn reading of music and sing properly in the chorus-line. Lateron everyone started yelling at him and he was expelled and he had to remain outside, when the others would sing. There he was, humming to himself his own song, kicking stars, shaking fists at his collegues and pondering how he could get back at them for he of course wanted the others to sing his song instead of the other way round and hence came the evil into the world in the very beginning of times, even before the world was created...
At one point Eru wanted to wait no longer and get it over with and he said: ''"Eä! Let these things Be! And I will send forth into the Void the FlameImperishable, and it shall be at the heart of the World, and the World shall Be; and those of you that will may go down into it."' This said - and of course together with a few FX tricks - he made the world with a snap of his fingers. Now 14 of those Ainur guys (those are called the Valar [sing.: Vala] with Manwë being their foreman or even the boss) and a couple of sub-ordinates (called the Maiar [sing.: Maia] were ordered - err... volunteered, even - to do go there and do the rough work of preparing Arda - and Middle-earth in particular - for Ilúvatar's children (Elves and Men), so they would find everything nice and cozy on their arrival. Some of those jobs were really tough: like creating light, the sea, rising the mountains (can you imagine what a crazy job that one must be?), trees, rivers and later even the sun and the moon, in short: anything and everything.
Still Melko wanted to have everything his way and destroyed a lot that they had made and kept hindering and offending Valar and especially poor Maiar who were working their hineys off to fulfil the orders of Manwë, their slavedriver, who had them working overtime and underpaid on behalf of Ilúvatar. The latter also being the reason that Melkor had an easy play to do some headhunting and hire a few of Manwë's Maiar (probably he was paying better or they changed employance because of the "fringe-benefits" Melkor could offer). Sauron was one of those and a few other ones that got new jobs as Balrogs and their main job back then was it to scare the hell outta the poor innocent Children of Ilúvatar or the Dwarves (I'm not quite sure though what exactly a job-description for a Balrog looks like or Gothmog would've already gotten my application-letter...) and hence annoy Valar and Maiar even more.
And of course there was anotherone of the Maiar we must not forget: Melian the most beautiful of their kindred that dwelled in Middle-earth, having created a small garden of eden (they called it "Doriath") with her beloved husband Thingol the multi named (also known as Greymantle, Greycloak, Elwe Sindacollo, Elwe Singollo or the "Hidden King"...) and they would have "lived happily ever after..." there, had not Thingol tried to get hold of an apple from the forbidden tree: in this case a Silmaril, which at that time unfortunately was part of Melkor's crown. And though Melkor was not the rightful owner of this Silmaril (he himself had robbed three of those Silmarils from Fëanor), he was rather partial of those. So, after Thingol had finally got hold of the thing, due to his brave daughter and son in law, that on the long run of course could not end well, and so - after a while - he lost wife, Silmarill and life...
And even much later in the 3rd age - Melkor had been fired long before and Sauron had taken over Melkor's job as CEO of the "Dark Forces Inc." - another handful of the Maiar (well, at least sorta) have been sent over from the almighty west to meddle in the competition between "Children of Ilúvatar Inc." also known as "Elves/Men-Alliance" vs. the "Dark Forces Inc." - something like the fight between Unix/Linux vs. Microsoft (Apple probably playing the role of the Dwarves) nowadays, but anyway, I am getting side-drawn - to side with the Elves and the Men. Those guys were called the Istari (Gandalf, Saruman or Radagast were of their kind).