Couples break up for lots of different reasons and there are also numerous events that can get them together again. A very simple but very effective action to helpget your ex backis to tell your ex that you are sorry for what you have done.
By apology I don't mean a meaningless sorry, I mean a sorry from the heart where you admit your short comings in the relationship and how you've learned from them. It takes a strong character to admit mistakes and your ex will appreciate it.
Breaks ups are often for silly reasons that are easily resolved, especially among younger couples. These can include issues with the amount of time spent with friends or what work is done around the house, they can result in a break up but can be easily fixed.
For example, if you're a male and expected your girlfriend to do all the house work which resulted in her leaving then you could soon fix the problem. If you apologise profusely and promise to start pulling your weight you will be on the road to recovery soon.
Of course this is only one example but this can resolve other situations with break ups too. Obviously you would then have to back up your apology with actions if the two of you are to stay together. If on the other hand you have cheated on your partner, then you may need more than just an apology to get things on track again.
If you did cheat and you want to know how to get your ex back then unfortunately there's no definitive answer. It depends solely on how forgiving your ex is and whether or not they feel the relationship can recover.
Saying sorry is very effective though, especially if you truly mean it and it shows. All is not lost though if your ex does not believe that you have changed and does not think they are sorry, there are still ways to get them back.