You should read the Silmarillion if you want to learn all this stuff. Or at least the first part of it, which is called the Ainulindale an the Valaquenta.
Yes, the "great music" is a metaphor for all the gods' powers being used in conjunction to create reality. There is one, all-powerful god named Illuvitar who created everything (at least indirectly).
The Valar and the Maiar are his "children." You can think of the Valar as gods, similar to the Greek or Norse gods, or as great spirits. The Maiar are their servants, and you can think of them as lesser spirits or angels.
The most powerful of the Valar, Melkor, became evil. He is sort of a corollary to Satan - an adversary purposefully created by God (Illuvitar).
Melkor corrupted some Maiar into evil and they became Balrogs, which are like demons. Remember the Balrog that Gandalf fought in Moria? That was a corrupted Maiar. Gandalf was also a Maiar, so you can think of him as being akin to an angel who has come to Earth at the behest of the gods. Saruman was also a Maiar. Another corrupted Maiar, and the most powerful, was Sauron.
Although its fiction, Middle Earth is supposed to be a sort of real world mythology. There is no specific time period in which the Lord of the Rings takes place, but the ages are several thousand years long each. The 4th age, which begins just after the Ring is destroyed, is supposed to be the very beginning of the modern age. So a few thousand years B.C. is not a bad guess.