Rom 9:16-18 "So then it does not depend on the man who wills or the man who runs, but on God who has mercy. For the Scripture says to Pharaoh, "FOR THIS VERY PURPOSE I RAISED YOU UP, TO DEMONSTRATE MY POWER IN YOU, AND THAT MY NAME MIGHT BE PROCLAIMED THROUGHOUT THE WHOLE EARTH." So then He has mercy on whom He desires, and He hardens whom He desires."
God compares Esau to Pharaoh. One has to wonder WHY did God love Jacob and hate Esau? WHY did God raise up Pharaoh? Paul answers that question by proclaiming God will have mercy on whom He desires and He will harden those whom He desires. That is God's prerogative.