Neurofeedback involves the use of electroencephalography (EEG) to measure electrical activity in the brain. Sensors are placed on the scalp to detect the brain's electrical signals, which are then displayed on a computer screen in the form of brainwaves. By providing immediate feedback, individuals can learn to modify their brain activity to achieve desired mental states.