A digital oscilloscope works by sampling an electrical signal, converting it into digital data using an analog-to-digital converter, and displaying the waveform on a screen for detailed analysis of voltage over time.