One of the great things about this Stephen King re-re-awakening is that people get excited about the author's classic novels again. It is in many ways the keystone work from King and determined a lot of what would come later, while hinting at a greater celestial tapestry of monsters and gods that he'd connect fully in his The Dark Tower series. Learning about Stephen King's deep cosmic horror should prompt a deep dive into one of King's biggest influences, the early 20th Century horror and sci-fi writer H.P. Lovecraft, who is basically the inventor of cosmic horror. Let's look at King's Lovecraftian gods.
Lovecraft's Cthulhu Mythos, which spans many stories and is the author's most famous contribution to horror literature, discusses beings from such groups as Great Old Ones, Elder Gods, Outer Gods, and more. This hierarchy is one of the most complex and varied of any in high-fantasy or science fiction, and he was always very open about other writers adding to and changing the mythology. It's a mythology in Wiki form. And while King mainly made up his own extensive mythology of gods and demons, several of them borrow heavily (or at least reference) some of Lovecraft's creations. Let's take a look at the most prominent.
King's most frequent villain is the necromancer/sorcerer known by many names, but most consistently Randall Flagg. He's described as "an accomplished sorcerer and a devoted servant of the Outer Dark" and generally aims to bring down civilization through destruction or sewing discontent and conflict in humanity. Appearing in seven novels, either as main antagonist or merely a cameo, Flagg is responsible for some of the worst and most decidedly evil deeds in any of King's canon. He's the big bad--known as The Man in Black--in The Dark Tower and is the nemesis of all that is good and pure.
This figure directly mirror's Lovecraft's Outer God, Nyarlathotep, who is likewise the most frequently featured entity in the Cthulhu Mythos. Unlike most of the Outer Gods or Great Old Ones who rarely take a form fathomable by the human mind, Nyarlathotep often takes human form in order to collect devotees and spread chaos. He is deceptive and manipulative, and even uses propaganda to achieve his goals. He influences the deeds of men, and carries out the evil of larger Outer Gods as well as the wishes of cults devoted to him.
King has all but said Randall Flagg--especially in The Stand and The Dark Tower series--is one of the many guises of Nyarlathotep. Since the Outer Gods can travel between realities, you can read Lovecraft and know that "The Crawling Chaos" made his way into the King reality.
It, which King wrote in 1986, is by far the author's most Lovecraftian work, setting up the idea of a Macroverse (later called the "Todash Darkness" of The Dark Tower series), and ancient, otherworldly beings from outer space/a different plane of existence. Of these entities, the most prominent is It itself, an ancient creature that feeds off of fear, and then ultimately people themselves. Initially taking the guise of Pennywise the Dancing Clown, It claims its name is Robert Gray, and takes on the forms of various horror movie monsters and its final form of a giant spider. It also exists outside of the Earthly realm in an inter-dimensional plane It refers to as "deadlights" and if a human should see these lights, they would be driven immediately and irreversibly insane.
It is not a direct allusion to any one Lovecraftian entity the way Flagg is tied to Nyarlathotep, but actually draws from several. Firstly and perhaps most prominently is Great Cthulhu--not in visage but in approach. The famous phrase the Cult of Cthulhu uses often is "At his home in R'lyeh, dead Cthulhu waits dreaming." The awakening of Cthulhu spells doom for all. It sleeps for 27 years and when it awakens, spells doom for those in Derry, Maine. It's final form as a giant spider-like monster is like that of several Lovecraftian nightmares. It using madness to maintain control, and humans being unable to fathom the awesome horror of such a creature also comes right out of Lovecraft's Cthulhu.
In It, we also learn about It's natural enemy, Maturin the Turtle, another ancient cosmic being that created our universe and countless others. In The Dark Tower, Maturin is established as one of the twelve Guardians of the Beams that hold up the Dark Tower itself. Though he acts mostly as a spectator to the events of It, Maturin is diametrically opposed to It (a being of creation versus a being of consumption) and aids Bill Denbrough in advising the Losers Club about the Ritual of Chud, which is the only thing that can ultimately destroy It.
In Lovecraft, there are a few deities that could be tied to Maturin, though not explicitly. One of the hallmarks of Lovecraft's work is that pretty much all of his deities are evil, or at least apathetic to the plight of humanity. Maturin is the creator, but is an ultimately benevolent entity. The creator of our universe in Lovecraft is the behemoth Outer God Yog-Sothoth, a mass of glowing orbs, with eyes or tendrils in some versions. He is believed to be trapped outside of our reality, but has created many beings over which he has influence. Another, more benevolent being is Nodens, an Elder God whose domain is mainly the Dreamlands and who has an army of faceless, bat-winged Night-Gaunts which help him hunt the minions of Nyarlathotep. So, a pretty nice guy.
In Stephen King's mythology, Gan is the greatest deity of them all, creating every universe, including the universe all of the books take place, the universe where King writes those stories, and the universe in which we read them. King himself is a player in Gan's scheme to tell the story of the Gunslinger in The Dark Tower books. Had King died prior to completing these, then all of the infinite universes of the mythos would have ceased to exist as well.
Lovecraft's over-arching god is not nearly as benevolent. Azathoth is the greatest of Lovecraft's deities in the Cthulhu Mythos. Known as "the blind idiot god," Azathoth is the god that dreams all of us, and all of everything. A disgusting mass of goopy tendrils and eyes, he rules over the Dreamlands through his emissary Nyarlathotep. What Azathoth wants, Nyarlathotep and others have to make happen, mostly because he's dreaming and can't do it himself. While people worship Azathoth, it's very likely Azathoth doesn't even know humanity exists, and should he ever awaken from his slumber, we would cease to exist.
There are obviously many, many more references in King's work to that of Lovecraft, and a phenomenal resource for this is Margaret L. Carter's 2005 essay "The Turtle Can't Help Us: The Lovecraft Legacy in Stephen King's It," which you can read here. Suffice to say, without Lovecraft's doom-laden obsession with the hierarchy of gods that see us as playthings at best, King never would have dreamed up his complex mythology, and both are ones well worth getting lost in.