In Sanskrit, Karma means action. A few thousand years ago, there was a conversation between Krishna (a Hindu god) and Arjuna (a prince). Krishna explains to Arjuna in this conversation, called the Bhagavad Gita, that as a human being, you are not entitled to the fruits of your actions. All you are entitled to are your actions.
The concept of Karma is the principle of cause-and-effect which, like Newton’s third law, states that every cause has an effect and every effect has a preceding cause.
Often people say that Karma is "what goes around, comes around" but this is not a proper definition. That is the concept of morality imposed upon Karma, which is not what this concept is designed for.
Another way of understanding Karma is by looking at genetics. Genetics has an order and predictability in understanding how someone is shaped to be. Like genetics, you are the result of the circumstances around you, your birth, your family's circumstances, and an infinitely preceding set of causes and circumstances that have led to the effect that is you.
Karma gives you the opportunity to accept your failures. If you find it hard to accept failure, chances are that you need to dig deeper and see if you really did give it your all. If you really did give it your all, then the consequence is simply out of your control. If your all wasn't enough, then that is okay. It was simply your Karma, or your set of circumstances.
People have trouble accepting failure because they do not understand what they are entitled to, and what they are not entitled to. Most people go through life expecting a particular result, which makes it harder to accept anything less.
This unrealistic expectation makes people bear responsibilities that are not their's to bear. Whether you believe in free will or determinism, Karma is in the middle and says that people are only responsible for their actions. The choice to act is theirs and once they act, they open themselves up to results.
For example, when people blame themselves for not "doing their best" on an exam, its not true because the only thing that they were responsible for was choosing to act. Karma handles the results. Even if they did not take the exam, that is still a choice because Karma from the past prevented them from acting now. Whether it be the fear of failing, not sleeping properly, or dealing with conflicts outside of school, they still did their best.
The answer to dealing with failure is compassion and forgiveness: something easily offered to other people when they fail, but not so easily offered to ourselves. So what we need to do is forgive ourselves and cut ourselves a break. We need to accept that we are not perfect and that we deserve some slack. We can’t be perfect all the time.
But that is not how our mind works and it’s actually really hard to be compassionate to ourselves. We think "I could've done it. I just need a little more...", so it is okay to beat ourselves up for not doing it.
The question arises — what kind of person are you not compassionate to? There are some people who we think are not deserving of compassion. And if you are not compassionate to yourself, then the logical conclusion is that you do not think you are someone who deserves compassion. This is a learned position.
The default position for human beings is believing that we are not failures and that we deserve compassion. The first step to being compassionate to yourself is to recognize where you learned that you are a failure. When did you learn that you are not worthy of compassion? Then you can start to figure out how you can change that opinion of yourself.
Think of karma as a seed that can be planted. The seed can be planted but it does not mean that the seed will grow and bear fruit. Likewise, people can act to influence their karma, but it does not mean that they will get the results they are hoping for. No one decides whether there will be results.
When you truly believe that you have done everything that you can, it becomes easier to accept failure and it becomes easier to act. When you give it your all and you fail, there is a bizarre amount of peace that comes with that. You can be proud of what you managed to accomplish and the fact that you chose to act, rather than ashamed of how you fell short. Instead of focusing on creating results, focus on cultivating, planting, and acting.
Forgive yourself for what you didn't do yesterday and focus on acting today. It doesn't matter if you do well or you do badly because it is your best. Karma is about living your life without blame and giving yourself all that you can.