Caution: This is a LONG-ASS post…
Okay…Arda (the world on which Middle-Earth exists) was sung into existence by Eru Iluvatar (God, basically) and certain of the Ainur (angels and spirits). Fourteen of the most powerful Ainur (fifteen if you count the bad guy) and many more lesser spirits entered Arda to help guide and shape the Music.
The fourteen most powerful Ainur were named the Valar, and the lesser spirits were Maiar. The fifteenth Ainur was Melkor, who coveted the Music and wished to shape it to his will. He spoiled the shaping of Arda in large and small ways, eventually harrying the other Ainur to form a refuge in the West which they could guard against him. So they raised high mountains around that land (the Undying Lands, including the region of Valinor where most of the Valar lived) and basically left Melkor to rule the rest of the world for the time being while they awaited the Elves, who had been foretold by the Music.
Arda was in darkness, with only the stars to light her, so Yavanna and Nienna, two of the Valier (the female Valar), created Telperion and Laurelin, the Two Trees. Telperion had silver flowers, which shone with a white light. Laurelin had golden fruit, which shone bright. The Trees glowed in alternation, 12 hours of silver light, a mingling of a few hours, then 12 hours of golden light, which mingled into silver again.
Soon Orome, the huntsman of the Valar, encountered the Elves, who had just awakened in the cove of Cuivienen, and encouraged three of them to accompany him back to Valinor as ambassadors. The three, Finwe, Elwe, and Ingwe, entered Valinor and beheld the Two Trees. They were returned to the Elves’ awakening-spot and convinced most of their people to join them on a trek to the West, to live in Valinor with the Valar in the light of the Trees. There was a significant minority which refused to go with them, and stayed behind. These were the first Avari (the Unwilling). As the Elves marched, the other Valar brought battle to Melkor to make the way safe for them. They captured him and brought him chained to the Throne of Manwe, the chief of the Valar, for judgment. Manwe, not having an understanding of evil, showed Melkor mercy and ordered him to remain chained for three ages of the Trees.
As the Elves progressed westward, they came to the Misty Mountains and, knowing they had to cross them, many turned southward to follow the Anduin. These were the beginnings of the Silvan Elves, who formed the populations of the elvenkingdoms of Mirkwood and Lorien. The bulk of the Elves continued across the mountains. They divided into three groups, the Vanyar, the Noldor, and the Teleri. Ingwe led the Vanyar, the Light-Elves, because they were ever the most eager to live in the light of the Trees and learn wisdom from the Valar. Finwe led the Noldor, who fell somewhat behind the Vanyar, being fascinated with the way that Arda was constructed, and the stones and metals and jewels that made her up. The Teleri, led by the brothers Elwe and Olwe, lagged farthest behind.
Eventually, the Vanyar and Noldor were carried across the sea by the Maia Osse, and entered the Undying Lands. The Vanyar settled in Valinor proper, closest to the Trees and the Valar. The Noldor settled mostly in the pass of the Calacirya, in the city of Tirion, where they were taught great secrets of smithing and creation by the Valar Aule.
The Teleri lagged behind, as always, and ended up settling for quite a while on the shores of Beleriand, because their leader Elwe had disappeared in the dense forests of the region. Elwe had come across the Maia Melian, and was enchanted by her beauty to the point of entering a hypnotic trance for YEARS. Melian, for her part, fell in love with the Elf as well. While Elwe was trapped by Melian’s beauty, Olwe reluctantly allowed a portion of the Teleri to be carried to the West by Osse, but the Elves begged him to ground the island on which they travelled in the bay outside the pass of Calacirya, so they could see the light of the Trees but also be close to the sea they had learned to love.
The Teleri who stayed and searched for Elwe became the Sindar, the Grey-Elves, who are sometimes classed with those who had never seen the Light of the Trees and sometimes are considered to have inherited some of the wisdom of the Eldar (the Elves who had gone to Valinor) because of their leadership by both Elwe and Melian.
The actual Silmarillion is a whole other epic and kind of beyond the scope of the OP’s question, so I’ll leave it for another thread.
As for the Dwarves, Aule (that Vala who got so chummy with the Noldor) had grown impatient to see the Children of Iluvatar, so he created a race of people himself, but couldn’t animate them. They were just lifeless shells. When Iluvatar questioned him about his experiment, Aule obediently laid the 7 Dwarf-fathers before Him to judge and to do with as he wished. Iluvatar valued Aule’s trust and obedience and agreed to breathe life into the Dwarves, but not until the Elves had awakened, as the Elves were in the Music as the Firstborn of the Children of Iluvatar. So Aule placed the seven Dwarf-fathers in widely separated caverns to awaken after the Elves had come forth.