On the subject of prayer and in the context of 1 Thessalonians 5:16-18: “Rejoice Always, pray without ceasing and in everything give thanks; for this is the will of God in Christ Jesus for you.”
John Wesley said, “One who always prays is ever giving praise, whether in ease or pain, both for prosperity and for the greatest adversity. He blesses God for all things, looks on them as coming from Him, and receives them only for His sake — not choosing nor refusing, liking nor disliking, anything, but only as it is agreeable or disagreeable to His perfect will.”
In essence, the heart of thanksgiving springs out of an understanding of God, His character, that He is the source of all things and that His will is to be sought above all else. Having that focus, I can continue in a perpetual attitude of thanksgiving to God for all that He has done for me, is doing for me and will do for me.