Surgeons use a grid of electrodes laid on a patient’s brain. They record electrical activity and can deliver a tiny jolt.