The 'gift' doesn't even necessarily have to be extravagant. For example: for waiters and waitresses, just giving mints at the end of a meal can increase your tip by over 20%.
That being said, it's not as simple as tossing a few candies onto the table and leaving.
In a study published in the Journal of Applied Social Psychology, researchers found that the method of leaving mints at the end of a meal affects the percentage of increased tips:
When waiters gave mints with the check and didn't call attention to the mints, tips increased about 3% against the control group where no mints were given at all.
Waiters who brought two mints by hand separate from the check and mentioned the mints to the table saw a 14% tip increase against the control group.
Finally, waiters who brought the check with mints, and then came back a short time after with more mints and mentioned them to the customers ("I thought you might like more mints!") saw a 21% increase in tips against the control group.
The 'personalisation' aspect of a gift is a big factor. If you're looking for a favour, first give some kind of gift that your target doesn't expect and that is personalised or shows special concern. You can get the same effect by doing a favour for your target before asking for a favour of your own, but the crux is to have it be unexpected, and to make them feel special.