Since
@BillTre answered the first part of your question, I'll give a few pointers for the second part about pain.
For normal sensing of pain, like when you are pricked by a needle or touch a hot stove, those depend on special pain-sensing neurons in the periphery. So pain has a special, separate pathway at the periphery. Whether pain also remains a separate pathway in the brain is unknown (most of us think it isn't, but imaging of brain activity doesn't have enough resolution to settle the question).
It is difficult to induce pain by stimulating the brain without stimulating the peripheral pain-sensing neurons, which is why it is often said the brain has no pain receptors, and one can operate on the brain without inducing pain. There are pain-sensing neurons in the meninges, the membranes covering the brain.
However, it is possible to produce sensations of pain in the brain by stimulating in the secondary somatosensory cortex (SII) and the insula.
Stimulation of the human cortex and the experience of pain: Wilder Penfield's observations revisited
Laure Mazzola, Jean Isnard, Roland Peyron, François Mauguière
Brain, Volume 135, Issue 2, February 2012, Pages 631–640
https://academic.oup.com/brain/article/135/2/631/261811
At a rough simplistic level, there are separate pathways in the brain for pain "sensation" and pain "unpleasantness".
It is possible to feel pain unpleasantness without being able to localize precisely the source of the pain, which is consistent with the idea that the pain "sensation" pathway can be damaged without damaging the pain "unpleasantness" pathway.
Pain affect without pain sensation in a patient with a postcentral lesion.
Ploner M1, Freund HJ, Schnitzler A.
Pain. 1999 May;81(1-2):211-4.
https://www.ncbi.nlm.nih.gov/pubmed/10353510
It also seems possible to some experience pain "sensation" without experiencing pain "unpleasantness"
Pain affect encoded in human anterior cingulate but not somatosensory cortex.
Rainville P1, Duncan GH, Price DD, Carrier B, Bushnell MC.
Science. 1997 Aug 15;277(5328):968-71.
https://www.ncbi.nlm.nih.gov/pubmed/9252330