How does mouse keep working when the battery is drained?
When battery is drained with time it provides less voltage. Which makes me wonder - how does appliance (like a mouse) keeps working with lower voltage?



Is it because electrical components inside can work with different levels of voltage?


Many types of circuit can be designed to be tolerant of a wide range of voltages. HCMOS logic is rated 2 V to 6 V for instance, though it's much slower at 2 V. Circuits made from cheap transistors can be made to work from 1 V to 30 V, 100 V with the right transistor. However, some components specify a very narrow range of voltages, CPUs for instance need very precise voltages to avoid blowing up the transistors, while still meeting their specified speed.


Or there are components that lower the voltage when the battery is full?


Regulators, especially LDO (low dropout) and buck switching regulators can be used to lower a high battery voltage down to a fixed operating voltage. The latter are rather less wasteful of power than the former. Obviously the regulator itself must tolerate its range of input voltage.


Or maybe vice versa - some how the voltage is amplified when the battery is drained?


This is done, but tends not to be just to cope with a drained battery. It is done to gain the advantages of using a single cell. For instance powering 5 V logic from a single LiPo which can range from 3 V to 4.2 V is an ideal instance to use a boost converter. PP3 9 V batteries tend to be relatively expensive energy for energy, I've seen some data sheets that suggest using their boost converters from 2 AA cells to drive 9 V apparatus much more economically.

Or something else?

I think tolerate it, step down, and step up, cover all the bases.
Different batteries have different characteristics. CR2032 type cells tend to have a relatively flat 3 V throughout their life, this is often taken advantage of to avoid the need for regulators in some low power devices. Alkaline cells at nominally 1.5 V still have a fair amount of energy left when they dip below 1 V, though many consumer items indicate 'dead battery' well before this. The reason is it's cheaper and easier to design a circuit that only works down to (say) 1.3 V. This is another reason why some devices just seem to 'eat batteries'. For the designer, as long as you are paying for the batteries, and there's no proper specification for their lifetime, they can get away with it. The first company I worked for, professional test equipment, the specification when alkaline batteries were used was 'must work down to 0.75 V per cell'.