When you are grateful you realize all the different experiences that come your way that you are grateful for. Many of those experiences involve other people.
Being grateful makes you realize how others contribute to your gratefulness.
This realization makes you more apt to give to other people. You realize the more you give the more connections and therefore the more opportunities for getting back.
By giving, you are making life fairer for everyone which in turn makes it more likely that things come back to you. It is a win-win situation.