Some parts of this answer are taken from the 2009 Stack Overflow blog post Comments: Now with Flags and Votes. Note that flagging has changed considerably since that blog post.
Comment votes
You need 15 reputation to vote comments up.
Upvote a comment by clicking on the up arrow that appears when you hover the mouse over the comment.
There is no downvoting of comments, only upvotes.
You get 30 comment upvotes per day.
Comment votes do not affect comment sort order.
When there are many comments on a post, some comments are hidden when the page loads, and there is a button to “show N more comments”. The comments with the fewest upvotes are hidden first. The threshold depends on the number of comments on the post and whether the site is a main or meta site.
When the question reaches a certain threshold of answers (30 on most sites), all comments with zero votes on both the question and all answers will be collapsed.
No reputation of any kind is earned or lost from comment votes, though the Commentator badge is awarded for leaving 10 comments, and the Pundit badge is awarded to those who left 10 comments, each with a score of 5 or more.
Comment upvotes can only be undone for a short time and while you did not navigate away from the page. Once you undo the upvote, you cannot upvote the same comment again.
You cannot upvote a comment that you've flagged, until the flag is dismissed.
You cannot upvote comments on locked posts.
No rate limit on comment votes, meaning you can upvote as fast as you want.
Comment flags
In general, you need the flag posts privilege to flag comments. If you don't have that privilege, you can still flag comments on your own posts and those on answers to your own questions, but are limited to "harassment, bigotry, or abuse" and "in need of moderator intervention" flags.
You cannot flag comments if you haven't registered your account (that is, you haven't associated a login provider such as Google, Facebook, or Stack Exchange, with it).
On sites which award the comment everywhere privilege before the flag posts privilege (Meta Stack Exchange, Stack Apps, and private beta sites), if you have enough reputation to comment but not to flag posts, you can flag any comment, but are limited to the above two flag options until you have full flagging privileges.
See this answer to Allow new users to flag comments on their own posts.
You have as many comment flags per day as you do post flags. Comment flags are counted separately from post flags.
If a comment is flagged by a sufficient number of users, it will be automatically deleted. There is no direct penalty for this. Unless the comment is deleted, comment flags will be surfaced to moderators, so if you have a problem with a comment, flag it.
You can always delete your own comments by clicking on the "Delete" button that appears when you hover the mouse over the comment. This is not a flag; it takes effect immediately. Note that there's a rate limit for deleting your own upvoted comments, however.
Flag a comment by clicking on the flag icon that appears when you hover the mouse over the comment. You'll need to choose a reason (see below).
Comment flags can be retracted; however, if your flag was one of the canned options and you retract it, you can't choose that flag option again for that comment.
If not handled by a moderator or automatically deleted, "harassment, bigotry, or abuse" comment flags age away after 4 days.
Comment flags do not directly affect the commenter in any way if a comment gets deleted, but they do count towards the flagger's helpful flags. A declined comment flag will not count toward a flag ban, but it does count toward one's net helpful flags and can reduce the flagger's daily flag allowance. Helpful or declined flags count the same as post flags toward the net helpful flag calculation.
An automatic moderator flag is raised if a user has too many comments on which "unfriendly or unkind" or "harassment, bigotry, or abuse" are marked helpful (manually or automatically) within a certain period.
The system does not notify you if your comment is flagged.
Flagging has a rate limit. You can flag a comment once every 5 seconds, and open the flag dialog once every 3 seconds. (More details here.)
Moderators are limited in the way they can dismiss comment flags.
Moderators can mark all pending flags on a comment helpful by editing or deleting a comment. There is no way to manually mark a comment flag helpful other than as a side effect of these actions. This means that borderline flags may be marked declined (though some mods may go through the extra step of deleting the comment to mark the flags as helpful and then manually undeleting it).
Alternatively, moderators can manually mark all flags on a comment as declined. There is no way to dismiss multiple pending comment flags with different statuses. This means that if one user has, for example, incorrectly flagged a comment as "harassment, bigotry, or abuse", and you correctly flagged it as "no longer needed", your flag may be declined in the process of declining the other user's flag.
Moderators cannot provide a reason for dismissing a comment flag.
You cannot flag your own comments.
You cannot (re)flag a comments that you already have an active flag on.
Comments by the Community user can only be flagged as "no longer needed".
When should I flag a comment?
You must specify a reason for each comment flag. The dialog offers a few pre-filled reasons that cover most common cases:
It contains harassment, bigotry, or abuse.
The comment attacks a person or group.
For extended explanations of the above flag types and when they should be used, see the "When should I flag a comment?" section in the "guide to moderating comments" FAQ post.
See also When should comments be deleted?.