The main cause for pain in the brain is inflammation which can be caused by no of things the second most common reason is brain tumor and the the third most common reason is embolic clot forming in the brain
The brain is insensitive to pain, but the pain is due to stretch of the meninges for any reason; meningitis, Increase ICP... etc