As AndroidPenguin described the nociceptive pathways are activated by inflammation or noxious chemicals.
Sometimes pain can arise independent of active nociceptive pathways. Most evident in cases of Neuralgia and perhaps in case of Pseudoneuromas.
In certain cases the injured nerve causes disinhibition of the pain pathways arising from the dorsal horn of spinal cord. This disinhibition is because of loss of the nerve function.
Sometimes increased nociceptor drive can activate dorsal horn of spinal cord which will now respond to normal mechanosensation also .
Phenotypic switching is also possible .
PS: Both these articles are inaccessible to me at this moment. Refer them for more details.