By far the most terrifying possibilities of using all hallucinogenic drugs (and the primary reason people are afraid of experiencing them) is the psychedelic crisis, more commonly known as a bad trip. The experience of a bad trip can range from slight persistent anxiousness and alienation to vast feelings of never-ending horror, entrapment, and death. This is an experience used by the media and anti-drug corporations to deter the use of hallucinogenic substances, and it is widely effective in that regard. In actuality, bad trips are infrequent and can lead to probable mental healing.
Dr. Timothy Leary said that the best way to reduce the probability of a psychedelic crisis was proper set and setting; set being the user's mental status and setting being the user's surroundings. He states that bad experiences are more common in psychologically unprepared people, and that having a positive attitude without fear and emotional stress (recent death of a loved one, job loss, breakup, etc) will greatly reduce the chance of a bad trip.
Setting also plays an important role in prevention. Being in a place the user is comfortable with, and a place that they have been to, will reduce the chances of a bad trip. Being in a place that is unrecognized by the user (parties where few people are known, concerts, government settings, etc.) will often cause bad trips and extreme paranoia.
Indeed, the best way to avoid this is not to think about it. It is a general conundrum.
There are a number of things that a person experiencing a bad trip can do to relieve it, at least temporarily and/or slightly. These would include listening to music, turning on/off a light source, opening or closing the eyes, moving to a different location (without driving obviously), watching television, or generally anything that is distracting.
Then again, one might not want to get out of a bad trip in the long run. Bad trips often engender because of emotional damage that has occurred and often been suppressed. Dealing with the bad trip, rather than trying to avoid it, can help a user cope and deal with, and possibly terminate, the problems that are being faced. So in the short-term, it might seem horrifying to deal with the psychedelic crisis, but the user may come out of it happier than when they went in.
There are also certain things that medical professionals can do to calm or subdue a psychedelic crisis. The most effective methods involve medication such as benzodiazepines such as diazepam or lorazepam, though these only eliminate the feelings of fear and anxiety rather than the hallucinations. Doctors will also try to limit external stimuli as best as they can to decrease fear.
In very severe cases, antipsychotics like haloperidol can reduce the hallucinations and fear, but only work on traditional psychedelics (LSD, psilocybin, mescaline, etc.) and deliriants (whose delirium often mimics that of a psychotic state). Antipsychotic medication is not effective, however, on dissociatives like ketamine and PCP.
Despite popular belief, psychedelic crises aren't that common. The media and press exaggerate the frequency of bad trips, but in reality, it's an approximately one in one thousand chance.