If I drink tea, then go to sleep for a while, when I wake up, will the effect of tea still be on me (the refreshing effect)?
Does it depend on the duration of sleep?
Caffeine is the stimulant in tea. It has different effects on different people, but if you can sleep right after drinking it, it probably isn't strong enough to have long term 'refreshing effects', And yes, the duration of your sleep does matter. If you sleep for 12 hours, much more caffeine will filter out of your blood stream than after a 1 hour nap.
Some info on how caffeine works, from here: