Foil: Literally a "leaf" of bright metal placed under a jewel to increase its brilliance. (Holman & Harmon 198)
Traditionally, a foil is a minor character who, through comparison and contrast, serves to highlight the brilliance of the protagonist.
Shakespeare uses the valiant Hotspur to foil Hal in order to provide the Prince of Wales with a motivation that moves toward redemption.
So says, the online Shakespeare:
In a plea to his father, Hal vows that he will redeem his tarnished identity at the expense of Hotspur, saying "I will redeem all of this on Percy's head," (3.2.137). However, the act of redemption does not only occur as the result of realization and motivation. Redemption needs for these ideas to be put into action. At the end of Act 5.4, using his realization and motivation as a basis for his actions, Hal consummates his transformation, by physically saving his father from Douglas and defeating Hotspur in a single combat at the Battle of Shrewsbury. Thus, the Prince of Wales has performed, what he had originally promised to do in his opening soliloquy, to redeem his reputation.
Reputation is very important in Shakespeare; it is the mortal part of oneself--like one's soul. In Othello, Cassio says, "I have lost the immortal part of myself, and what remains is bestial." Hal is foiled not only by Hotspur but by Falstaff, showing the valiant (public) and entertaining (private) sides of Hal's character respectively.