The transporter effect is accomplished as follows:

1) Fill a canister with water. Add glitter and shine a light through it. Stir briskly and tape.

2) Film the scene, first with the actor, then without. (Or vice versa).

 3) Transfer the scene to tape, and use video technology to matte the glitter over the actor.

4) Use a video wipe to 'streak down' the glitter. 

 

Transporter accidents

Though transporters were a quite safe way to get from one point to another there were still cases of transporter accidents:

On stardate 1672.1, in 2266, a strange ore had altered the function of the transporter, causing the most bizarre transporter accident on record in which Captain James T. Kirk was split into two: One embodied all of Kirk's so-called positive qualities and the other part that was evil. It was some time before the mishap was discovered, and the malignant version of Kirk roamed the ship, stealing liquor, assaulting crewmen, and even attempting to rape Yeoman Rand. When he was cornered, and finally captured in the engine room, his errant phaser shot damaged the transporter further. Scotty and Spock isolated and repaired all the damage. Their repairs were confirmed when a test animal, previously split, was sent through the transporter in an attempt to reintegrate the two creatures. Upon reintegrating, it rematerialized dead. Crippled with indecision, Kirk was able, barely, to make the trip, and his two halves were reintegrated once again. (TOS: "The Enemy Within")

On 2267, an ion storm caused a transporter accident. After failing to persuade the Halkan Council to allow the Federation to mine dilithium in on their planet, a USS Enterprise landing party, expecting to beam back on to their ship, were beamed aboard the unfamiliar Enterprise in the Mirror Universe. Upon beaming aboard, they discovered that the peace-loving United Federation of Planets had been replaced with a brutal Terran Empire, and that they had their own "mirror" counterparts. (TOS: "Mirror, Mirror")

In 2361, on Nervala IV, the USS Potemkin was conducting an evacuation of the science outpost on the planet. Lieutenant Riker was part of the away team at the time. An unusual distortion field meant the Potemkin had difficulty beaming up Riker. A second confinement beam was initiated to overcome these difficulties, with the intent of reintegrating the two beams in the transporter buffer. This was unnecessary as only one beam was successful at transporting Riker, the modulation of the distortion caused the second beam to be reflected back down to the surface, materializing two Rikers, one on the ship, and one on the planet's surface. The Potemkin left orbit, unknowingly abandoning the duplicate Riker. After eight years, this accident was discovered by the Enterprise-D who revisited the planet, found Lieutenant Riker and brought him back to the ship. (TNG: "Second Chances")

 

Heisenberg compensator

Taken from the Memory Alpha website

The Heisenberg compensator is a component of the transporter system works around the problems caused by the Heisenberg uncertainty principle (hence the name), allowing the transporter sensors to compensate for the inability to determine the position and momentum of the target particles to the same degree of accuracy. This ensures the matter stream remains coherent during transport, and no data is lost. (TNG: "Realm of Fear")

While trying to devise a way to transport holographic matter off the holodeck without it disintegrating instantly, the idea was put forth that decoupling the Heisenberg compensators might let the matter reform normally, although the suggestion was used as a stalling tactic against Professor James Moriarty, and the idea had never actually been tried before. (TNG: "Ship in a Bottle")

The Heisenberg compensator circumvents the Heisenberg uncertainty principle, which states that one cannot know both the position of a subatomic particle and its momentum to arbitrary precision.

When asked by Time Magazine in 1994, "How do the Heisenberg compensators work?" Mike Okuda replied, "They work just fine, thank you."