If the brain has no pain receptors, how come you can get a headache?
Brain, indeed, cannot feel pain, as it lacks pain receptors (nociceptors). However, what you feel when you have a headache is not your brain hurting -- there are plenty of other areas in your head and neck that do have nociceptors which can perceive pain, and they literally cause the headaches.

In especially, many types of headaches are generally thought to have a neurovascular background, and the responsible pain receptors are associated with blood vessels. However, the pathophysiology of migraines and headaches is still poorly understood.