I use to do it when I am hanging out with a girl I like, I have been making out with her but not sexually yet. It is a good place to start telling her that you are interested in something else and not asking it directly (which reduces the possibilities of success by the way). I think that girls find it less offensive than grabbing their breasts unexpectedly or other places, and you can do it easily while dancing or making out and while standing. I would definitely not do it to a girl I don't know or think in the inside that she is going to get mad about it. You have to take your chances though... :)
well I really don't think when I to do it, its just arousing lol but be a little more detailed, do you mean in public or Private cuzz I would never grab my girls ass in public (hate being the center of attention) but in private ill rub the hell out of it... why? Because to me (Meaning just me and possible to other guys) the ass is equivalent to boobs in the way that their fun to grab and look at for no reason at all other than sexual arousal.
If he's your ex and you've talked to him about how you no longer have feelings for him, then the next time he does it, flip your lid. Hard. Wig out on him and make him back off. Giggle at your vengeance later.
If you do still have those pesky feelings for him, then talk to him and ask him why he continues to push your buttons. Because there are chances that that's his immature way of saying he likes you and wants to get back together.