Everyone handles a breakup differently. The one being broken up with usually comes off the worst, but that doesn't mean the one doing the breakup isn't affected at all.
There are usually feelings of doubt and guilt involved.
So, to answer your question, "why does my ex flirt with me?" It can be for several reasons.
First of all, some people like playing games, mind games in particular. One of their tactics is to use flirting to mess with your head. They are trying to invoke a reaction from you.
Be careful, because, if you respond to their flirtations by flirting back, they are likely just to use you for the fun of it and then dump you all over again.
You should be well aware if your ex is this sort of person or not. If they are, be grateful you've split up and ignore them completely.
Secondly, and it's not much better, your ex could be flirting with you because they are not in a relationship at the moment and they see you as a "temporary" solution...