If I believe I've failed myself i have to ask: "am i mad at myself?", "why do i think I failed?", "was it possible to not fail"?(i ask this because sometimes failure is unavoidable), and most importantly: "can i forgive myself?". Sometimes it may be hard to forgive yourself but think about it like this. If someone did what you did, failed like you did, would you forgive them? Would you be less harsh one someone else? If your kind to others, why aren't you kind to yourself? Remember: your a person with feelings.
Now, if you feel like you've failed someone else, why? What makes you think your a failure? Did you do something, or is someone acting different and you just think you've failed? You have to remember that sometimes people just get mad and sometimes you cant change that. If you actually did something, apologize, if they don't accept the apology, drop it. You aren't responsible for others acceptance.