The best way to take compliments
- Show them, through your tone and body language, that you appreciate their compliment. Make eye contact with them, and smile, or giggle, or whatever feels appropriate.
- Thank them. They have gone out of their way to give you some positive reinforcement. If nothing else, it demonstrates that they value you and are interested in forming a closer connection with you by giving you something positive - namely, a statement about yourself.
- Attempt to build on that, if you would like to, by giving something back. Namely, share some information about how you got that _______ that they've just complimented, and build a conversation from there.
Avoid deflecting the compliment. They have attempted to give you something positive, and by deflecting it you either demonstrate a general low self-esteem (which is usually an unsettling danger signal to the other person), or else an indication to them that you don't value them, don't want to make a meaningful connection with them, and would probably privately prefer to be as far away from them as possible. In short, it's a socially-acceptable method of being rude, and they will feel that.
Avoid giving them a compliment in return. This is a rule of thumb, and if it's in a situation where everyone knows it's a mere social formality to be pleasant, then it's fine. But otherwise, it comes across as an empty attempt to flatter them, and everyone knows you don't mean it. That will hurt them, and affect the connection you have with them. If there is actually something you want to compliment, give it about ten minutes and bring it up as a new subject. Or mention, "Oh thank you! That's such a coincidence, because for the last few minutes I've been noticing ____________ about you and debating whether to say anything." That is credible, and will strengthen your connection with the other person.
As a side point, it never, ever fails. I will notice that a lady is wearing some amazing earrings and compliment her on them in passing. A baffled look will cross her face for a moment, she'll completely freeze, and then she'll reach not one hand up to an ear, but both hands. Only after she's felt her earrings to remember which pair she has on will she then relax, smile, and thank me so much for noticing. I always sigh an inner sigh of relief at that point, because she evidently has some really hideous pair of earrings at home that would have caused her to respond completely differently to my innocent compliment. "What?! I hate these earrings! Why did you have to bring them up? Get out!" Whatever they look like, they must be godawful, since she bothered to check which pair she had on first. I always count my blessings when she brightens up and thanks me for the compliment, because I could have caught her on The Wrong Earring Day.