Typically, the sugar rush from normal Red Bull drinks lasts anywhere from half-an-hour to an hour-and-a-half, and less for the sugarfree version – depending on the body-type of the person drinking it, their absorption ability of caffeine, and their immunity to caffeine.
Taurine and caffeine are two of the primary ingredients in Red Bull. Taurine can be consumed in large amounts, and has no known side effects. Caffeine should be limited, and is most likely the reason you posted this question.
Because the sugar-rushes are so short, I believe the absolute latest you could drink a Red Bull, even a sugarless one, is 2 hours before you plan to sleep.
Sources:
http://ezinearticles.com/?Red-Bull,-Does-it-Give-You-Wings?&id=19264
http://ask.metafilter.com/14878/Red-Bull-High-Duration