1. Are you sorry? If so, allow yourself to feel the sorrow.
Do not justify or excuse, just feel the sorrow.

2. Are you ashamed? Realize that the shame is a result of treatment you have received, but under it is real sorrow. Feel it.

3. Are you blaming someone? Realize that what you are blaming another for is something that is hidden within you.

You may indeed be genuinely sorry, with no clutter of the above feelings. If so:
4. Allow yourself to feel it. The name for this emotion of feeling genuinely sorry is "remorse". It is a worthy emotion to feel.

After you have let yourself experience the remorse, if it is possible:
5. Talk to the person you have hurt, do that honestly, without trying to make yourself either right or wrong. Tell them what you have done, all of it, and that you are sorry.

If it is not possible,
5a. Talk to another person that you trust. Honestly say what you did, and that you are sorry. Accept that you are forgiven. Forgive yourself .