Some people view flirting as nothing more than having some fun.
However in truth more often than not flirting is a way of "testing the waters". If she/he flirts back gradually it escalates to sexual innuendo.
Nevertheless if the other person takes offense to being flirted with it gives the flirter (a way out).
"I can't believe you thought I was serious!"
Suddenly the offended person is on the defensive or appears small and lacking a sense of humor.
The reality is most relationships between couples started off with a certain amount of flirting! Most people would not be happy to see their mate or spouse flirting with anyone. Therefore on some level we know it is considered a gateway to cheating. A married man who flirts with women is not going to make his wife happy. The same holds true for any husband who witnesses his wife flirting with other men.
Last but not least even if you are flirting for "fun" it's vey possible the other person may believe you are sincerely interested in them. Naturally once they discover it was all in "fun" they may feel as though you mislead them or got their hopes up.