How can I learn to forgive if I have tried for years and failed?
Like so many things, the purpose of forgiveness is not the end of the process. The purpose of dance is not to finish dancing. The purpose of a vacation is not the plane ride home. The purpose of forgiveness is to transform pain into insight, and suffering into depth.

Forgiveness starts right in the core of resentment and anger the second we become willing to let it go. If you have been trying to forgive for years, for years you have been forgiving.
It is a wise and honest part of ourselves that will not move on until we have taken the journey as far as it needs to go. A healer once said to me - you've already paid for this, so milk that motherfucker for all it's worth.
I've been both sherpa and climber on this range. There are many paths up the mountain, the most beautiful are irrigated with tears. Here are some things I have learned:
Forgiveness is a creative process. The more creativity you can bring, the more profound the insights and the quicker the process will resolve. So write about it, fingerpaint what your pain looks like, make collages, act out where you've been in your own interpretive dance. Let the art be where the ugly is seen.
Take care of yourself and learn how to rest - I tend to intellectualize or distract myself when I need a break. Don't let taking a break become a way of life, though. When the anger or resentment returns, go back to the creative process as soon as you can and for as long as you can.
Pray for the person that harmed you. Pray that they have all the things you yourself truly desire. In particular, pray that they be well enough and wise enough to not hurt people any more.
Look for helpers and guides. Because forgiveness occurs on more levels than just ego, your psyche will try to position you to meet people who can assist you on this journey. This is particularly true if you have been praying for the person you are trying to forgive.
Forgiveness does not require cooperation from the person you are forgiving. Here are four things you do not need to do with them:
Tell the other person their current forgiveness status.
Allow them to harm you further
Require them to understand why you are upset or apologize or even acknowledge what they did
Treat them in a way that later you will have to justify or feel bad about.
Just because you don't need to do these things doesn't mean you won't do them. As a rule of thumb, though, practicing restraint will keep things from becoming more complicated than they already are. On the other hand, the mistakes you make will be folded into what you learn at the end, so be kinder than necessary if you screw up.
Forgiveness is complete when we can not see any other way the past could have unfolded but the way it did. Forgiveness is done when we are grateful for the lessons learned and the person we have become.