I have a close aspie friend who never gives compliments. Ever. And in fact he is very critical of nearly everyone, but never to their faces. I understand the reasons for this, that they may reflect his own life experiences, etc. But nevertheless, those two things combined lead to the impression that he does not really like any of his friends and may speak badly about all of us behind our backs. That can be hard to swallow. I don't really expect compliments all the time, but every once in a while it would be nice to know our friend actually likes or appreciates SOMETHING about us, rather than simply feeling like we are the people he's stuck with for lack of better options. The only compliment he has ever given me has been something like "I like your shoes" which really has nothing to do with me. He would have liked them on the store rack just as well.
So, if you're looking for insight on how and when to give compliments, I agree with the above. Make compliments when they are sincere; you don't need to make things up just to flatter someone. Avoid complimenting body parts for people in whom you are not romantically interested. Otherwise, your'e good to go. Complimenting people's actions is normally the safest and the most personal/appreciated. Examples: "You did a great job at X" or "It was really thoughtful of you to Y" or "You are really good at Z." If people tell you about an accomplishment you can simply say congratulations. But as stated above, compliments are optional, so you need not give them if you don't have it in you or feel awkward doing so.
On the receiving end, there was a recent thread about this, but simply saying "thank you" is more than sufficient. If compliments make you uncomfortable, you can simply say thank you and change the subject. A quick thank you is the fastest way out of the conversation if that is the goal.