Basically, pain occurs due to the nerve fibers in areas that have high levels of sensory input, like the skin, and the nerve fibers from areas that usually have low levels of sensory input, like internal organs, happen to come together in the same area of the spinal cord.