I haven't had a bad trip in a long time, but I remember what happened when i did. in my experience, bad trips can vary greatly epending on what substances you take.
mushrooms: my "bad" trips on these involved taking large doses ,then thinking i was for some reason going to die or remain tripping for the rest of my life. these types of trips only happened early in my tripping, eventually i learned that the key to avoiding them is 1) set & settin (of course) and 2), importantly, to remember that no matter what, in a couple hours the effects of the drug will subside and you WILL return to normal. now whenever i take a high dose of fungus and the come on gets a little uncomfortable, i just sit down, relax, and remind myself that in 30 mins to an hour my trip will be sensational, b/c many times the best trips start out uncomfortable
LSD: i have only had 2 "bad" trips on lsd, one of them purely because i was in a shitty setting with no way of leaving (downside to driving a standard transmission car, my friends couldnt drive it home). The only other negative effect i've had from lsd also involved taking too much, and experienceing a very intense, uncomfortable rushing as the doses came on. i had eaten 3 hits and was tripping well, then my friend gave me 4 more, intending for it to be 2 but accidentally squirting out 4. they came on really strong and i could feel my soul? ego? slipping away from me and i was becoming part of the stars and universe. however, the rushing caused me anxiety, which made it hard for me to "let go" and led to worries about me being crazy after the trip ended. eventually the rushing subsided and the trip was nice, but still a little uncomforatble, and the next day my emotions were all out of wack (crying for no reason, etc).
for me, the only negative worry i get sometimes about lsd is that i'm going to be crazy afterwards. I think this is partially to blame on lsd's crazy cosmic nature, and also on how long lsd lasts and the slow gradual way that the trip ends. like the first poster said, i would *highly* reccomend making it a policy of keeping benzos or sleeping pills on hand when you take lsd. benzos are really helpful if you get some anxiety during your trip, and benzos or ambien are crucial to have as "landing gear" so you can sleep after lsd.
i havent had any bad experience from any other substances. salvia was terrifying, but thats salvia