Why does my tooth hurt if I no longer have a nerve?

When an endodontic procedure is performed, there are still nerve endings at the external level of the root, which can generate a sensation of pain with a thermal stimulus (heat, cold) or percussion (when closing the teeth) because there is a periodontal ligament that surrounds the tooth and generates stimuli to some nerve endings that exist in the bone. But when the endodontic treatment is completely finished, all symptoms disappear.