Surgery is typically considered when conservative treatments such as medication and physical therapy fail to provide relief. It is also indicated in cases of severe conditions like brain tumors, spinal cord injuries, and certain forms of epilepsy that do not respond to other treatments.