5-Hydroxytryptophan (often called 5-HTP) is a compound that exists as a metabolic intermediary between tryptophan, an amino acid, and serotonin, a neurotransmitter involved in many emotional and perceptual states. Since 5-hydroxytryptophan is a precursor to serotonin, it is also sold as a dietary supplement that may aid conditions such as depression or insomnia.
Most neurotransmitters can not pass the blood/brain barrier, which is a fairly healthy defense mechanism for the body to have. If you were to take a heaping spoonful of serotonin, it would not have a direct effect on your brain. (Although it would have an indirect effect, since its work as a neurotransmitter and hormone on other body systems would most likely make you very, very sick.) 5-Hydroxytryptophan, however, has not been converted from an amino acid into a monoamine yet, meaning it can pass into the brain. Since it already has had the hydroxy group added to the tryptophan, it should be used solely for conversion to serotonin, and not metabolized into any of the other compounds that tryptophan is a precursor for.
This is the theoretical basis for how and why 5-Hydroxytryptophan works. Given what is known about the metabolism of serotonin, and the roll that serotonin plays in mood and behavior, it makes sense that 5-HTP should be pharmacologically active. In fact, it would be counterintuitive if it did not. And indeed, there seems to be a good amount of evidence, both from anecdotes and research, that it is active. The more complicated question is for who it is active, and for what conditions. The largest problem probably comes from the fact that there are a dozen different types of serotonin receptors in the brain, all with different pharmacologies and subjective effects. In other words, there is not a simple function between "more serotonin" and "feel happier" and "sleep better". For that reason, while it makes sense that 5-Hydroxytryptophan should have some influence on mood and perception, it doesn't follow that it is a magic bullet.
This conclusion is perhaps influenced by my own personal experiences with 5-HTP to fight insomnia. Although it sometimes seems to work to make me fall asleep, it has often seemed to be a fairly unpleasant, groggy sleep. In addition, it has on several occasions caused by pre-sleep relaxation period to be a somewhat unpleasant trance state with weird images and thoughts. (And not in a fun way). And while I might believe that 5-HTP works well for others in combating insomnia, depression, overeating, or many other problems, I would also remind people to proceed with caution.