A voltage stabilizer works by measuring the voltage level of an electrical system, comparing it to a preset level, and then using electrical components such as transformers, capacitors, or voltage regulators to adjust the voltage as needed to maintain a constant level.