If your ex hates you, it’s going to be more difficult to get them back than if things had ended more amicably. Negative feelings of any kind create resistance and we have to overcome those negative feelings before getting back together is even a possibility.
The first thing that you need to do is back off completely. These negative feelings dissipate with time, not with effort and persistence. You can’t argue with your ex and convince them they shouldn’t hate you. They simply need to be left alone and those feelings will slowly fade on their own.
The length of time they need to be left alone varies depending on how negative and strong you think these feelings they have for you are but I recommend at least a couple of weeks (minimum) and that is if things ended relatively well and there is very little negativity. If your ex literally hates you, you may want to wait up to 90 days before trying to contact them.