Say it's come to your attention that you fucked up. How do you handle it?
Step 1: Get defensive. No, don't get defensive to the person informing you of your fuckup (unless it's a third party and you just need to blow off steam). But it's okay to have a defensive reaction! Most of us mean well and really did have the best intentions when we blew it. Or we just weren't thinking. Rarely is it a matter of malice, and if it is, you've got bigger issues to sort through than figuring out how to apologize. So, let yourself have your defensive reaction. Recognize it and acknowledge it, because if you don't, it's going to fuck up your apology later.
Step 2: Pay attention. If the person you fucked up with is the one telling you about it, listen carefully to their complaint. Ask questions to make sure you understand the issues. Rephrase what they're saying in your own words and ask for clarification about the points you don't understand. You may think that your fuckup is that you were late whereas they may be upset about the fact that you didn't communicate about it. Same event, different issues. You can apologize for what you see as your fuckup, too, as long as you also acknowledge and apologize for the thing they're upset about.
Step 3: Say, "I'm sorry." Stop there. Don't say, "I'm sorry, but ..." Everything that comes after the "but" in that statement is likely to be defensive explanation. It might be useful to talk about this later, but it's not part of your apology. Don't say, "I'm sorry you feel that way," or "I'm sorry that's how you see it," or anything like that. That's not an apology but instead an expression of condolence akin to, "I'm sorry neighborhood punks egged your car." Just because it includes the words "I'm sorry" doesn't make it an apology.
Step 4: Explicate your apology, acknowledging what you learned in step 2. "I'm sorry I didn't call when I realized I was going to be late. I know that left you alone to the wolves at a party of people you don't know, and that sucks. I'm also sorry I was late at all, and I feel terrible about it."
Step 5: Are there things you need to do to further make amends? If you're going to make a plan to improve future behavior, great, but make sure they're realistic. Don't, for the love of all that's good in the world, promise something you can't meet. Do you need to fix something? Do it. It's okay to ask the person you're apologizing to if there's anything they need you to do to help them feel better about it, but don't make it their job to think of the amends you should make. Show that you've put some thought into it (by putting some thought into it).
Step 6: AFTER you have fully apologized, THEN you can talk about the factors that went into your fuckup. "I know this doesn't change your experience of it, but the reason I was late is that I was rescuing a baby from a burning building, and I had to wait for the paramedics to arrive before I could leave." This is your chance to explain your good intentions or hopes and other thoughts that came up for you during step 1 and feeling defensive. It's important not to retroactively undermine your apology during this step by putting more energy into defensively explaining what happened than you did into apologizing.
If you realize you fucked up before the person brings it up, that's awesome. This is your big chance to make it all your job to fix it. It's always better to be proactive. Don't wait; apologize today!
Don't overdo it. A dramatic apology for a small offense blows things out of proportion. You accidentally kicked someone under the table while crossing your legs? A sincere, "Oh, I'm so sorry! Are you okay?" is all you need. Overblowing an apology can, at times, be worse than no apology at all.
The apology is not your opportunity to make the other person take care of you or your problems. You may feel terrible and it may connect to deep-seated issues in you. That's a great thing to know and maybe even to work on with the person you're apologizing to, if you have that kind of relationship, but that should be a different conversation.
Okay? Let's review:
Step 1: Be defensive somewhere else.
Step 2: Pay attention and ask questions.
Step 3: Apologize, full stop.
Step 4: Expand on your apology, if appropriate.
Step 5: Make other amends as necessary.
Step 6: After a full apology, explain without getting defensive, your intentions or the circumstances that led to the mistake.
We can't stop ourselves from fucking up sometimes, but we can stop ourselves from being jerks about it afterwards.