How I apologize:
I refrain from getting defensive or considering whether or not it is "my fault" -- regardless of my intentions, the point is that you were hurt.
I try to fully understand how my actions hurt you,
("so when I did action Y that hurt you because situation/perspective Z")
I empathize with you and apologize,
("I can imagine how that would hurt; if I had been in situation/perspective Z I would have felt the same way. I imagine you felt _____; I'm so sorry")
THEN AND ONLY THEN
I explain my feelings and motives,
("I can see how it seemed like I just didn't care, but my intention was _____, and I definitely do care")
I figure out how to avoid ever making the same mistake, and
("I think that happened because situation/perspective X")
I commit to a change which will keep me from making that mistake again.
("I commit to being more careful, avoiding situation/perspective X so as not to do action y")
or to make it simple: empathize, explain, change.
a not-real example:
I said "you poopyface!" when you wouldn't get me some water. You tell me that this hurt you. I take you seriously (despite the fact that objectively I wouldn't have imagined that calling someone poopyface in a joking tone could be hurtful) and say "I'm sorry -- can you tell me why?" You explain that in the past you had had a parent who had manipulated you with using spiteful words to punish you if you didn't do what they wanted, and my saying that felt like I was trying to manipulate you.
(empathize) I say "oh, wow, yeah I can understand why that would be so upsetting. It's horrible to feel like you have to indulge someone's every whim or get verbally abused. I never want to do that to you -- I am so so sorry." You say "Why did you do it?" (because you are assuming that I had a reason other than manipulating)
(explain) I say "I was just being silly, I didn't mind even a little bit when you said no. I DEFINITELY didn't want you to do it in response to me calling you a poopyface." I continue, "I think I did it because I didn't realize how it might make you feel. I knew that about your parent but I didn't stop to think. (or, I didn't know that about your parent)"
(change) I add, "From now on I will be much more aware and careful to avoid making punishing remarks, including as jokes." Then I say "I really am sorry" and you say "I forgive you" and then hugs or I-love-yous are exchanged.
It doesn't always work out so neatly, of course; sometimes it ends in a compromise rather than a simple change. If the action that caused pain was something important to me yet not integral to who I am, then I would not change completely but I would try to find some way to minimize the effect on the other person. For instance if I feel like it is important to me to be an omnivore and they find it painful to be close with someone who eats meat, I might cut down on the amount I eat or eat it only when not around them or make sure I support only good farms. The important thing is that I show care and make an effort, and be honest about what I am or am not willing to do so that they can make the best choice for them.
It's really important to me not to skip the empathizing step because if I do, the other person will often feel as if I don't care about their feelings and am only concerned with whether or not I made a mistake. And when someone is apologizing to me, if they don't empathize BEFORE explaining then it feels like my feelings are an afterthought, rather than the point of the conversation. But it's also important to figure out how not to make the same mistake, because otherwise it will just happen again.
Obviously on lesser wounds it's not necessary to go to all that effort -- accidentally stepping on someone's toe is not the same as triggering a memory of abuse. HOWEVER, which wounds are 'lesser' is defined by the person in pain, NOT the one who caused the pain.
Sometimes people seem to take "you hurt me" as some kind of challenge to their honor, thinking that they have to prove that they did NOT hurt you or they are therefore a bad person. (my bioparents, for instance, ALWAYS react this way) But I consider it much more honorable to heal something than to never have harmed it in the first place.