Non-volitile memory chips....... various types with varying properties.
https://en.wikipedia.org/wiki/Non-volatile_memory
There can also be a small battery good for many years on a circuit board that can maintain a small volume of information for many years.
Some of the chips can be reprogrammed when power is on; but will hold the same zeros and ones when the power goes off.
Been a lot of advancements in computer chips in the last 3 or 4 decades and some of it is not well known. The miniturisation and addition of huge amounts of storage space is fairly well known, however, many of the Hard Disk systems which stored information magnetically on a disk, are now being replaced entirely by Solid State Drives, which store information on memory chips similar to a thumb drive. The advantages are much faster read and write, as well as zero moving parts. Solid state drives come in a vast array of capacities, with the larger ones able to replace the traditional disk storage hard drives on laptops and other devices.