In today's passage, there are two aspects of thanks. They are both, interestingly enough, about the thanks that it is not given.
The passage is a particularly famous passage, because it speaks about loving our enemies and about being merciful in judgment ("judge not"). Leaving aside the abuses of this text, let's consider its discussion of thanks.
The first example is if you "do good to them which do good to you." There is no thanks for this, because you are simply returning the favor that you are given. Similarly, if you "lend to them of whom ye hope to receive" you don't deserve thanks, because you're basically doing business, not helping someone out. Loving your enemies is the way to obtain their thanks, since you do not owe them your kindness.
The same is true, and more so, of us. We were the enemies of God and he showed favor (grace) to us. We ought to be thankful, because we did not deserve that favor. This is not (despite what some Arminians seem to think) a situation where God was kind toward those who were kind toward him. God is not returning a favor to us, nor is God hoping to get something back in return for the kindness he shows to us. He's not our lender, he's our Redeemer. Thus, we ought to be thankful.
The passage brings this out, because it says "ye shall be the children of the Highest: for he is kind unto the unthankful and to the evil." This is actually the second mention of thanks in the text. God is kind to those who are not thankful and who are evil. We ought to act likewise. Children act like their parents. We may deserve thanks from our enemies to whom we are kind, but we should not expect to receive thanks. When God blesses a wicked man with riches and a long life and he does not thank God, we realize this is commonplace. So, we should not be surprised when our own kindnesses to others are not thanked by our enemies.
I've also included a similar passage in Matthew. You will notice that in the Matthew account the more general word "reward" is used in place of "thanks," but the general teaching is the same. Notice how the kindness of God is illustrated in Matthew in giving rain (to water crops) both to God-fearers and God-haters.
Notice as well (by seeing the comparison of these passages) that this mercy of God is part of being "perfect" as the Father is "perfect." True love of our neighbor requires that be kind to our enemies - and in this way we imitate our Father, showing ourselves to be His children.
The final passage shown below, drives home the point that we are unable to deserve the thanks of God. Jesus uses the example of a servant that does what his master tells him to do. Such a servant is not deserving of the master's thanks, because he has simply done his duty. The same goes for us - even when we are at our most righteous, we are simply doing what God has required, and consequently cannot claim any merit in our actions. God doesn't need to thank us.
But I say unto you which hear, Love your enemies, do good to them which hate you, bless them that curse you, and pray for them which despitefully use you. And unto him that smiteth thee on the one cheek offer also the other; and him that taketh away thy cloke forbid not to take thy coat also. Give to every man that asketh of thee; and of him that taketh away thy goods ask them not again. And as ye would that men should do to you, do ye also to them likewise. For if ye love them which love you, what thank have ye? for sinners also love those that love them.
And if ye do good to them which do good to you, what thank have ye? for sinners also do even the same.
And if ye lend to them of whom ye hope to receive, what thank have ye? for sinners also lend to sinners, to receive as much again.
But love ye your enemies, and do good, and lend, hoping for nothing again; and your reward shall be great, and ye shall be the children of the Highest: for he is kind unto the unthankful and to the evil.
Be ye therefore merciful, as your Father also is merciful. Judge not, and ye shall not be judged: condemn not, and ye shall not be condemned: forgive, and ye shall be forgiven: give, and it shall be given unto you; good measure, pressed down, and shaken together, and running over, shall men give into your bosom. For with the same measure that ye mete withal it shall be measured to you again.
Ye have heard that it hath been said, Thou shalt love thy neighbour, and hate thine enemy. But I say unto you, Love your enemies, bless them that curse you, do good to them that hate you, and pray for them which despitefully use you, and persecute you; that ye may be the children of your Father which is in heaven: for he maketh his sun to rise on the evil and on the good, and sendeth rain on the just and on the unjust.
For if ye love them which love you, what reward have ye? do not even the publicans the same?
And if ye salute your brethren only, what do ye more than others? do not even the publicans so?
Be ye therefore perfect, even as your Father which is in heaven is perfect.
But which of you, having a servant plowing or feeding cattle, will say unto him by and by, when he is come from the field, Go and sit down to meat? And will not rather say unto him, Make ready wherewith I may sup, and gird thyself, and serve me, till I have eaten and drunken; and afterward thou shalt eat and drink?
Doth he thank that servant because he did the things that were commanded him? I trow not. So likewise ye, when ye shall have done all those things which are commanded you, say, We are unprofitable servants: we have done that which was our duty to do.