, wouldn't you like to go back and fix things before it had happened? If this is your case, here is how you can win your ex back. Bear in mind your ex in all probability needs some space right now and so do you. What you should do is give them about a week to themselves.
Do not try to contact them by any means during this time. You do not want to appear as though you are chasing after them, you would be giving up your power to them in this case. You must look like you are in control of your life, don't let your ex know that you want them back.
Your best case now would be that your ex will come back to you on their own after realizing they should not have left. After a week or so goes by and your ex does not contact you, then it would be ok to send them an email. Just say something simple like how are you doing. You do not want to look like your are anxious for them to come back to you. Hopefully you can generate more communication from there.
If a month or so has gone by and the two of you are still not back together then you need to take further action. It would be ok to keep in casual contact with them, just enough that they know you are still there. Do not stalk them trying to find out what they are up to. You can take a radical step and ask one of your ex's friends out on a date, ask your ex where you should take them.
This will spark some interest from them, they will think that you are moving on, and with their friend. They will question whether they should have broke up with you and may contact you with a renewed interest.