The Spanish Inheritance
At the end of the seventeenth century the Habsburg king of Spain was about to die without having a child. The Spanish empire was still the largest in the world, encompassing: Spain, the Southern Netherlands, half of Italy, large parts of South and North America, big possessions in the Caribbean and the Philippines. It was only through gross mismanagement that it was not the superpower it used to be. It was clear that any monarch that could add this empire to his own posessions would be in a position to dominate Europe. Therefore on the initiative of William III attempts were made to make a settlement before Charles II died.
Louis XIV had a claim to the inheritance as husband of the daughter of Felipe IV by his first wife. The legal problem with this was that Maria Theresia had wavered her rights when marrying Louis. The condition of this had been that Spain presented a wedding gift that it had not given. The practical problem was that an accession by Louis XIV would immediately create an empire dominating Europe and a general war to prevent such a thing coming to pass. Louis of course wanted to have the crown for his family. The next candidate of the Bourbons would be:
The 'Grand Dauphin' Louis
The Crown-prince of France's mother (wife of Louis XIV) was a half sister of Charles II. The practical problem was that this heir would unite the crowns of France and Spain and was thus unacceptable to Europe a fact that even Louis XIV understood. As a solution to this problem Louis proposed that the dauphin should also pass and:
The Duke of Anjou
Philip duc d'Anjou, second son of the Grand Dauphin should inherit the throne. Anjou of course had a right equal to that of the dauphin should the crown prince waver his right. As Felipe V he would succeed in firmly establishing himself on the Spanish crown.
Holy Roman emperor Leopold
Emperor Leopold was widower of the youngest daughter of Philips IV, but also a grandson of Felipe III. The main problem with this candidate was that he would reunite the Habsburg empire and the Spanish crown. Even though Spain was now much weaker then at the time the two empires were united by Charles V, Austria was now much stronger. The creation of such a potential superpower would not find many supporters in Europe. Leopold therefore proposed:
Charles was the second son of Leopold's second wife, and as such did not descend from Felipe IV. Charles would reign in Madrid for a short while as Charles III. He later became less acceptable to Europe after succeeding Leopold as holy Roman emperor.
The 'Prince-elector' Joseph of Bavaria
From the emperor's marriage with the youngest daughter of Felipe IV descended a grandson of the emperor, and son of the elector of Bavaria, who was still a minor. This was a candidate acceptable to the whole of Europe, and officially even to France and Austria, as it would only add Bavaria to the Spanish crown.
Here is a simplified representation of the relations of the pretenders, indicating only how they were related to the daughters of Felipe IV.