Dive into your creative stream
I've expanded the instructions I gave for apologizing into a detailed listicle. I hope it'll be helpful. Some of the points, however, are very specific to the English language.
1. Don't explain what happened, it will sound like you're justifying your actions. And because of the way our brains work, you're likely to actually start justifying your actions. At that point, you're no longer apologizing. Remind yourself that the apology needs to have priority right now, and that there will be time later to identify causes and solutions.
2. Be specific, or at least use more words than "I'm sorry." "Sorry" is used so often as a polite noise, nearly meaningless, that it's difficult to be sincere, or even sound sincere when using it for a formal apology. Again, this ties into what @theconcealedweapon wrote: we're trained to say "sorry" when we don't mean it, so that becomes the core of the word's meaning, without our even realizing it. And if you're Australian, it gets even worse!
Personally, I use "I apologize" or "My apologies," or in dire circumstances, "Please accept my apology." This allows me to break my conditioning and focus on my genuine contrition, as well as making it clear to others that I'm taking the apology seriously.
3. Apologize for what you did, and absolutely NOT how it made someone feel. The latter is often used for manipulation.
Other things not to apologize for:
that the consequences of your actions happened
what you don't like about the person or group you're apologizing to
being right
being better than the people you're apologizing to
allegedly not having any idea what you're supposed to be apologizing for
...you'd think all this would go without saying, but it can be subtler than you might expect, and sometimes we do it without thinking, because we picked it up as children, from the nastier adults around us.
Instead, take a moment to focus on what you did, and how to describe it clearly in a way that accepts your fault and/or responsibility for the situation. Again, don't bring anything else into the apology, lest you make it seem less of an apology. People are so used to hearing the above crap from unrepentant people, that they will not give you the benefit of the doubt.
4. Watch your tone of voice. This is actually two separate points.
First, yet another thing we unconsciously pick up as children is the obviously sarcastic mock apology. It's not always a bad thing, it can be a joke or a verbal gesture, but you have to make sure you don't let that habit find its way into a genuine apology, and ruin it. This is where the bit about "Say it like you mean it" comes from. The easiest way to say it like you mean it is to mean it. See next paragraph.
Second, if you can't be respectful and express regret, you shouldn't be apologizing just yet. You're not ready. Leave the art of convincingly faking an apology to the con artists and cult leaders. You will probably need to just keep your mouth shut for a while. Acknowledge (to yourself) the possibility that you might change your mind later. In some rare cases, it may be possible to tell people, "I'm not ready to apologize just yet," but don't count on it.
5. (optional) If necessary and you can do it honestly, either characterize what you did, or agree with others' characterization of it, or promise to/ask how to not do it again, or multiple of the above. Say that it was wrong or inappropriate or a failure or whatever. Name people who called you out, say they were right, and repeat what they said about what you're apologizing for. If you promise not to do it again, don't pivot to talking about how great you will be in the future, keep it focused on the apology.
This might be a bit too much for less dire apologies, and you may not be able to manage this if you apologize the minute you can bring yourself to be sincere, but otherwise, you can build yourself some credibility by immediately seeking to improve yourself and make sure that YOU never do whatever-it-was again. It's more for privately apologizing to your direct supervisor, or to a friend.
On the other hand, beware of doing this if you're the authority figure, or are apologizing to a large group, because politicians routinely pivot away from making actual apologies by making big promises for the future. People are wise to this, though, and your whole apology is liable to be dismissed as bullshit if you try to use it for self-promotion.
So many people seem completely unaware of what a genuine apology is.
And that's because children are forced to say sorry on command.
Before they ever had a chance to process what they did, why they did it, what effect it had on others, or what they should have done instead, they're expected to say that they're sorry. And they're expected to "say it like you mean it" with no indication of what that even means and with no time to figure out how to phrase it correctly.
Sometimes, even when the child's actions are justified by any logical reasoning, they're expected to apologize because an authority figure demands it.
The goal of saying sorry ends up being solely to avoid punishment. And they phrase the apology in whatever way the authority figure will accept.
The result is an entire society filled with people who give completely useless apologies that appear like they're only trying to avoid punishment.