Heroic Inspiration is a rule the DM can use to reward you for playing your character in a way that’s true to his or her personality traits, ideal, bond, and flaw. By using Heroic Inspiration, you can draw on your personality trait of compassion for the downtrodden to give you an edge in negotiating with the Beggar Prince. Or Heroic Inspiration can let you call on your bond to the defense of your home village to push past the effect of a spell that has been laid on you.
Your DM can choose to give you Heroic Inspiration for a variety of reasons. Typically, DMs award it when you play out your personality traits, give in to the drawbacks presented by a flaw or bond, and otherwise portray your character in a compelling way. Your DM will tell you how you can earn Heroic Inspiration in the game.
Once you have gained Heroic Inspiration, you either have Heroic inspiration or you don’t—you can’t stockpile multiple “Heroic Inspirations” for later use, so you are encouraged to use them frequently while roleplaying your heart out so that you can keep the Heroic Inspiration flowing.
If you have Heroic Inspiration, you can expend it when you make a d20 Test— which is to say an Ability check, Attack Roll, or Saving Throw. Spending your Heroic Inspiration gives you advantage on that roll.
Additionally, if you have Heroic Inspiration, you can offer your Heroic Inspiration to another player, giving up your Heroic Inspiration to allow them to have the benefit instead.
For expanded rules on how you can utilize Heroic Inspiration, look here.
As a rule of thumb, the DM should aim to award Heroic Inspiration to each character about once per session of play at a minimum. Offering Heroic Inspiration as a reward encourages certain types of behavior in the players. The following is a good list of examples of what a player might do in order to earn inspiration:
For each significant action that a player takes or moment of exceptional roleplaying, the DM or any other player aside from the acting player, may choose to award a point of Heroic Inspiration.