Maybe it failed because your partner wasn’t faithful, maybe your personalities just didn't "click", or maybe you both got bored with each other. There are plenty of reasons why relationships fail.
The first thing to do is give your old relationship the funeral it deserves. This goes for a lot of things in life outside of relationships. You have to move past the hurt feelings and the disappointment. The better your relationship was, the worse this process may be. A lot of it also depends on how long the relationship lasted. The old adage of "well, we can just be friends" is very difficult to make work; it's better to just make a clean break and forget everything - the sooner, the better.
The best way to get over these feelings is to put your mind on something else. You are not a robot, so you can’t turn your feelings off and on like a faucet. What you can do, however, is introduce yourself to activities that help you feel good and get your mind off the relationship. Volunteering is one of the best ways of doing this, or sinking yourself into one of your creative pursuits such as art or photography.
If you feel overpowered by your circumstances and don’t know where to turn, then now might be the time to learn about meditation. You cannot stop strong emotions, but what you can do is learn how to control them. Meditation is the act of bringing your mind and thoughts under control. This might seem weird and "new age", but I come from a family of meditators - it works for me and it can work for you.
Find a quiet spot, undisturbed and away from any cluttered areas in your house. Get into a comfortable position. Then, concentrate on your breathing. Think of nothing else. If a stray thought wanders into your mind, simply objectively throw it away and go back and concentrate on your breathing.
Knowing how to get over a failed relationship is knowing how to master yourself. It’s knowing how to remove pain and fear from your life. It’s a hard road, no doubt, but it can be done and time heals all.