|Source information needed!
Originally, humans were taught the ways of the arcane by the high elves in exchange for their help in defeating the trolls during the Troll Wars. However, after the war, the human magi who were taught by the elves started to pass their knowledge and powers onto the younger generations who had no concept of responsibility that the original human magi had. They started to delve further into the arts for their own personal gain rather than the advancement of their race and eventually started to penetrate the darker aspects of the arcane. Eventually the agents of the then banished Burning Legion were drawn to this increasingly reckless use of magic and demons started to appear in Azeroth, especially around the new magic capital of Dalaran where the huge amount of wielded magic caused the fabric of reality to weaken.
The Kirin Tor tried to cover it up but the local populace started to become suspicious of their mage leaders. Eventually the elves intervened and decided to tell these human mages about the dark demonic past and their narrow escape from oblivion during the collapse of the Well of Eternity. They formed a secret pact with the humans which aimed in protecting the world from demonic influence. This secret organization was called the Order of Tirisfal. They chose powerful magi to become Guardians and act as the right hand of the Order. These Guardians wielded powerful magic against the encroaching demons. However, publicly, anyone found still using these dark energies were thrown of out the Kirin Tor and ejected from society.
Many of the human warlocks pledged their lives and services to the Lich King just prior to the invasion of his undead Scourge. In the Lich King's service many of these warlocks became skilled necromancers. In addition, the Lich King granted many of his undead servants limited warlock abilities as well. When the portal to the Twisting Nether was finally opened and the demons began pouring through, it seemed that the heyday of the warlocks was at hand. However, many of the human warlocks after the third war are former mages, fresh from the destruction of the Violet Citadel, who seek revenge, embracing the path of the warlock in order to turn the fel energies of the Legion against itself.
Gnomes have also taken up the mantle of the warlock. They are outcast by other gnomes, as demonic magic has been outlawed in Ironforge causing many of their number to train in Stormwind. It is safe to assume that gnomes were probably influenced by humans in the decision to study the dark arts. Even though gnomes are not as strong or agile as their human and orc counterparts, they have just as much dark potential..
Orcs, while chronologically not the first to use this magic, were perhaps the first modern (playable) race to be given the power of warlocks from the masters of it in the Burning Legion. Some of the most powerful mortal warlocks in history were orcs.
During the First and Second Wars, the formerly shamanistic orcs were transformed into a warlike juggernaut of destruction by their demon-influenced shaman leader Ner'zhul and later, the orcish warlock Gul'dan -- Master of the Inner Circle of the Shadow Council and Destroyer of Dreams. The Horde soon added warlocks in various forms to their armies, and orcish and ogre warlocks came to be feared within the ranks of the Alliance.
The first orc warlocks were the apprentices of the elder shaman Ner'zhul as Kil'jaeden's pawn, but were ultimately loyal to the elder shaman himself and not the Burning Legion. The second generation, created and led by Gul'dan, were more successful. They succeeded in turning the orcs against the draenei and poisoning the orcish race by tricking the chieftains into drinking the blood of Mannoroth. In order to police the clans, the Warlocks formed the Shadow Council. Only six of the 25 major clans resisted (the Frostwolves, the Shadowmoon, the Thunderlords, the Laughing Skull, the Bonechewers and the Shattered Hand). Despite the Council, civil war wiped out all but 12.
Gul'dan was later contacted by Medivh, and the two worked together to bring the Horde into Azeroth. (Sargeras, at the time controlling Medivh's will, was aware that Kil'jaeden had enslaved the orcs and it was easier to bring the orcs than the Legion.) Gul'dan led 7 of the remaining clans of orcs (Stormreaver, Twilight's Hammer, Bleeding Hollow, Blackrock, Dragonmaw, Burning Blade, and Frostwolf) through the Dark Portal. The warlocks continued to operate normally until Doomhammer seized power and had them exterminated.
In modern times, the orc warlocks still exist on the outskirts of the new Horde, headed by Thrall. While they are looked down upon for their hand in handing their race over to the demons, they are still allowed more or less within the society as they have pledged to use their powers against the Legion and vowed never to succumb to its corruption.
The origin of the Forsaken warlocks resides in Dalaran, where the mages there were slaughtered and resurrected by the Scourge as undead warlocks and necromancers. When the Forsaken emerged, the Banshee Queen tried to get as many of these undead spellcasters on her side as possible. The fact that these dark magisters can use their powers to free undead is the main reason warlocks are not shunned in Forsaken culture.
Many Forsaken priests, after losing touch with the Light, began to use demonic energies instead. It was a double blow to the few compassionate human priests still alive in Lorderaon; to see their brethren not only suffer undeath and to lose touch with the light, but to metaphorically spit on the religion of the Holy Light, abandoning its teachings for a more dark power.
Undead warlocks are most likely one of the best class/race combinations for PvP, due to their racials of Cannibalize and Will of the Forsaken, which make the Undead in general excellent for most PvP roles.
Other Warlock Races
High Elf warlocks
Some high elves turned to this path after their glorious home of Quel'Thalas was destroyed in the Third War. This new breed of warlock seeks to control the powers that ravaged their homeland and use them for vengeance. These few remaining high elves who are warlocks have long since become blood elves.