The central nervous system reacts to whatever the sensory system tells it is going on. Therefore, the pattern of activity from pain and warm nerve fibers triggers both the sensations and the physical reactions of heat, including vasodilation, sweating and flushing. Most people think of the 'burn' of spicy food as a form of taste. In fact, the two sensory experiences are related but are very distinct. They innervate the tongue the same way, but the pain system that is triggered by capsaicin is everywhere on the body, so one can get thermal effects everywhere.
Some liniments contain compounds that produce similar temperature stimuli to the nerves in the skin.
Menthol acts in much the same way as capsaicin, but in this case, it stimulates the fibers that register cold temperatures, not those that respond to warmth. The chemicals fool pain receptors whose real purpose is to register critical events, like damage to the skin and the inflamation that often results. The tenderness around an injury is caused in part by the response of these same nerves to chemicals released in the skin.