The researchers attach sensors to the patient and then ask them to complete a computer game which requires "use" of their limb. The game then senses the nerve input from their brain and responds as if they were using the missing limb.
Once the patient is trained to recognize their virtual limb, therapists can help them rehabilitate. This allows them to so things such as relax a clenched fist because they see the fist relaxing virtually. The pre-motor cortex, which is the part of the brain that uses senses to keep people aware of their own body, recognizes the virtual hand as the person's due to its reliance on sight in the absence of weight and feeling.
This is a technological step up from mirror therapy where a mirror is used to reflect the limb so the brain can picture having two limbs instead of one. These type of therapies have been found to be more effective than medications to treat phantom limb pain.
Virtual reality has also been used for phobia and PTSD treatment by helping people relieve their anxiety in a safe environment. It has even been used to help burn victims by putting them in a virtual reality to make them imagine some place cooler.