The need for, and the rightness of giving thanks to God, is recorded countless times in both the OT and the NT. It's as though we are to begin to thank him even before we have decided what we are going to thank him for! The priests and Levites "were to stand every morning to thank and praise the Lord" (1Ch 23:30). And we are all his priests. Individuals followed their example. "I will present my thank-offerings to you" (Ps 56:12). The whole family of God was commanded: "Give thanks to the Lord for he is good. His love endures for ever" (Ps 136:1); and believers are to encourage one another: "Let us enter his gates … and come before him … with thanksgiving" (Ps 100:4; 95:2).
Giving thanks is an essential part of prayer. "I thank and praise you, God of my ancestors, you have made known to me what we asked of you" (Dan 2:23). "Father I thank you that you have heard me" (Jn 11:41). "I always thank my God as I remember you in my prayers" (Phm 4). Devote yourselves to prayer, being watchful [not negligent or distracted] and thankful [prayer's essential characteristic and inspiration] (Col 4:2).
We are to give thanks for everything, taking nothing for granted and abandoning all sense of entitlement. "I thank Christ Jesus our Lord, who has given me strength" (1Tm 1:12). "I always thank God for all you" (1Cor 1:4).
Giving thanks is an essential ingredient of discipleship. "So then, just as you received Christ Jesus as Lord, continue to live your lives in him, rooted and built up in him, strengthened in the faith as you were taught, and overflowing with thankfulness" (Col 2:6-7). "Let the peace of Christ rule in your hearts, since as members of one body you were called to peace; and be thankful" (Col 3:15).
"Thanksgiving towards God will promote humility for it develops the awareness that every gift is from him. It kills self-pity, resentment and bitterness. Thanksgiving towards others, especially fellow believers, means being constantly alert to discern in their words and deeds any possible ground for gratitude, rather than being on the watch for an encroachment on our rights which must be resisted" (H M Carson).
We are to constantly give thanks for our own salvation and to so live that others learn to thank him too. "Since we are receiving a kingdom that cannot be shaken, let us be thankful and so worship God acceptably with reverence and awe" (Heb 12:28). "All this is for your benefit, so that the grace that is reaching more and more people may cause thanksgiving to overflow to the glory of God" (2Cor 4:15). "Your generosity will result in thanksgiving to God" (2Cor 9:11). "I urge, then, first of all, that petitions, prayers, intercession and thanksgiving be made for all people" (1Tm 2:1).
A lack of expressed gratitude draws down God's judgment. "The wrath of God is being revealed from heaven against all the godlessness and wickedness of men … for although they knew God, they neither glorified him nor gave thanks to him" (Rm 1:18-21). "Among you there must not be even a hint of [… any form of sinful indulgence …] but rather thanksgiving (not the word I would have expected in this context, so of great significance)" (Eph 5:3).