Just like the tabletop game it's based on, Baldur's Gate 3 runs off of dice rolls. Everything in the game, even if it isn't shown to you, generally has a dice roll in the background that determines the outcome, from combat to conversations. When you are prompted to roll for a skill check, you will be shown a D20 with the minimum needed to succeed in that check, as well as any advantages or disadvantages your specific character has depending on the stat that roll is based on. On some rolls, you could have a high skill and add a few points to the die, making it easier to pass, while others will have negative modifiers, making it less likely you will pass. Failing a roll means, well, you don't succeed in whatever you were attempting to do, but Inspiration Points can bail you out of a bad outcome provided you've earned them in Baldur's Gate 3.
What Inspiration Points do
You can think of Inspiration Points as do-over points since you can spend them on any failed skill check to reroll the die and get another shot at passing it. Rerolling with an Inspiration Point does not guarantee your second roll will be successful, so if your odds are really bad, you will be just as likely to fail a second time as the first. These points aren't very common, so don't waste them on checks that are essentially impossible to pass.
How to gain Inspiration Points
Inspiration Points are directly tied to your character's Background, which is different from your class or your race. While creating your character, you will pick a general origin for your character that colors their past and how they will treat and be treated by others. Not only should you pay attention to your own Background, but those of any companion you're traveling with as well, since they can also earn Inspiration Points for you based on their Backgrounds. In both cases, this is done through what is known as Background Goals.