When you thank someone, you tell them how grateful or appreciative you are. You'll definitely thank your friends if they get together and throw you a fabulous surprise party for your birthday.
If you appreciate something, like friendly, quick service at a restaurant or a stranger's generosity, you'll want to say, "Thanks!" Saying "thanks" or "thank you" is just one way to thank someone: you can also write a grateful note, leave a tip, or bake them cupcakes. People sometimes say, "Thank goodness!" when they're relieved that some disaster was averted.