Sometimes it happens by accident, but personally, I think it's a way of leaving your mark on the person - kind of like marking your territory - to let other people know that you belong to that person. Actually, I think people do it out of insecurity because they want people to see and know that they were with you and that the two of you at least made out. They like to announce it publicly in order to feel good about themselves.
I think some women are more susceptible sometimes and in the heat of passion some men get carried away trying to show their passion. Men are the yang energy while women are the yin energy which means that men are used to taking action. I think they feel by doing this they are showing you their love and affection.