Matt Colville has started streaming some brainstorming sessions for his upcoming D&D campaign. The format is far longer and more rambling than his "Running the Game" videos, so they might not appeal to anyone who isn't already a Colville fan and interested in experiencing his thought processes. I doubt I'll watch all of them, but I did listen to the first two, Creating a Pantheon, Part One: Culture First and Worldbuilding II, Gods and Culture. It prompted me to think about my own methods for creating a pantheon of gods for my campaigns.
One of Colville's main points was that the gods should be tied into the culture and values of the people who worship them, so these two videos involved at least as much discussion of the culture of the campaign's setting as it did about the god themselves. I've found this to be true in my own world-building. I've often started with a sense of needing gods for various portfolios (to cover all the existing alignments and domains, for example), but the best results come from considering the history of the world and tailoring the gods to better fit the specific people who worship them.
When creating my "Time of the Tarrasque" campaign, I started with gods ruling over the seasons, the elements, various celestial bodies, and dragons. I didn't want to have to create a separate, full pantheon for every race (as has been done in most "official" D&D worlds), so I initially kept my list of gods very short. As I added details to the various subsets of gods, I realized that some would appeal to certain races more than others, so the list slowly morphed into several small, distinct pantheons of a handful of gods each, which appealed to different races but weren't necessarily exclusive to one.
Then I focused for a while on working out the broad strokes of the history of the world. Each of the core races has an origin story that involves an exodus from another continent (humans and halflings), from under the earth (dwarves and orcs), or from another world (gnomes and elves). These migrations suggested further refinements to the gods and their relationships to each other, and pointed out places where I needed to invent more gods to fill in some gaps. I ended up with the following groupings of gods:
Dragon Goddesses: The chromatic and metallic dragons each have a parthenogenic patron goddess. Their one and only mating was a disaster, spawning the abomination called the Tarrasque (which is revered as a god by races that prize raw strength, like orcs). Beyond this dubious legacy, the Adamantine Dragon has been adopted as a patron by some paladin orders, and at least one minor island nation, while the Prismatic Dragon has recently gained much more influence through the conquests of a dragon-ruled kobold nation.
Dwarven Gods: This was the only pantheon that I borrowed from another source (Green Ronin's Hammer & Helm: A Guidebook to Dwarves), because it consisted of an elegant, minimalist trio of gods--Smith, Hammer, and Anvil.
Faerie Sovereigns: These deities of the four seasons are worshiped primarily by the elves and gnomes, who claim to have come from a primeval faerie realm parallel to this world. These gods change gender and partners with the turn of the seasons, which results in far less rigid definitions of gender and sexuality among their followers than among other races. Druids of these and other races often revere the Faerie Sovereigns and other nature spirits.
Celestial Gods: The sun god and moon goddess, and their child, the sexually ambiguous god of shadows, were first worshiped among the halflings. This holy family is opposed by the Void and its death cult, who are responsible for the catastrophe that drove the halflings out of their homeland to the far south. (Distressingly, the Void cult has apparently infiltrated a number of Underdark races as well.)
Elemental Gods: These four gods were originally worshiped by the ancient giant races' civilization that predated the arrival of the smaller races on the continents of Iath and Hemut. Few if any giants worship all four gods anymore, and the evil giant races follow corrupted versions of their favored elements' gods.
Human Gods: The first true human empire was a matriarchy, with a pantheon ruled by goddesses of justice, crafts, and war. A war with evil titans destroyed the empire, and the survivors sought a new home across the sea to the east. This pantheon is also the largest, mostly because I wanted some of the feel of the Roman Empire, which was one of the primary inspirations for ancient Prothonia and its descendants.
Because of this past conflict with the titans, most humans still fear and hate giants of any kind. However, during their long exodus, some humans abandoned their ancient gods, and turned to the worship of the four elemental gods, whose ruined temples they discovered in their new-found home. These reconstructed cults are anathema to the Prothonians, because they are derived from giantish traditions. Centuries later, this religious conflict still plays a major part in the politics of the modern human nations.
A third group of humans made friendly contact with the halflings, and settled among the smaller race. These men eventually adopted the worship of the celestial gods, which led to the founding of a theocracy ruling over both races.
Outsiders: Finally, a number of outsiders of various alignments provide minor gods and demigods for races who don't follow any of the preceding pantheons. Some examples include the Lord of Kytons (hobgoblins), the Hag Queen (hags, orcs, bugbears), and the Prince of Vermin (drow).