First, please consider who is giving you the gift?
1. This is very important, if the someone giving you a gift is a person you do not like, or that you know has alternative motives, bless yourself and politely refuse. If they insist, refuse again. No matter what the gift is, refuse.
2. First, if you have been offered a gift from a person trying to make amends, before accepting, consider if the gift is sincere; or, is the gift a peace bribe. Secondly, if you were in the wrong, realize how desperate this person is to have things be better. If the gift has personal or deeper meaning, seriously consider returning one in kind. If a person gives you a gift of something that they prized, say, a memento of sorts, return it after you are done appreciating it, and perhaps offer them a gift with importance to you.
3. Now, if someone you do not know offers you a gift, seriously consider the motive. If it's a stranger trying to befriend you, think of what kind of relationship that will become. Do think of what it means, not of what it is. Remember, in the end the choice is up to your judgment - judge wisely.
4. If you have a casual friend or coworker give a gift, it is not likely to be personal. It is likely something given in mass to multiple others, such as impersonal friends and other coworkers. A thank you and a smile should do.
5, part one: On to a place more difficult, when a good friend offers you a gift, you will realize that it is to receive. It's easy to consider yourself worthy of a menial or temporary prize, and it isn't so easy when someone close to your heart gives a gift from their heart. You may even feel guilty or unworthy, or maybe shame or that you must repay them with a gift yourself. These concerns rob both people in the party. Don't feel guilty, a gift brings joy to the 'giver' when they see a 'free joy' of receiving on someone they love's face. If you feel that you MUST repay them, simply be thankful and accept their love.
5, part two: Now, when 'the someone' you love gives you a gift, that is the time when it is hardest to know what you feel about it and how to react. You may act undeserving, refuse the gift because it was 'too much', or may quickly give them a gift in return. Instead, show them how much it means, how amazing it is to you that they are 'giving' to you, and most importantly, share with them the joy of getting something without paying/working for it.
Truly, the best way to receive a gift is to show joy. It rewards the giver and lets you enjoy your gift, receive a pleasure, and appreciation. Do NOT act false, but think about the thought that went into your gift.
To receive what was not 'bought' for yourself is the most humble of things.
To receive something you didn't earn, could not earn, is humbling but it should also bring a happiness of getting something.
To say you don't deserve or have not earned is irrelevant, but it can make the giver lose the happy balance that comes from giving, for truthfully, the fact they are giving you something makes you deserving. Accept it.
The receiver is always deserving in the heart of one who loves them. Enjoy your gift. You are somebody's favorite person.