How to activate Power Loss Recovery in Marlin?
Marlin firmware has such a feature that can be enabled to resume printing after a power outage.
To enable power-loss recovery you should send
M413 S1 

to the printer using a console (e.g. using Pronterface, OctoPrint, Repetier-host, etc.) or put commands in a text file with extension .g that can be printed from SD card. To disable power-loss recovery send/print:
M413 S0 

To report the state of the power-loss recovery, send through a console:
M413

This will result in a returning message in the console of e.g. This Power-loss recovery ON.
To retain the setting, you can use M500 to store it in memory.

If you enable M413 in Marlin firmware, the printer will write a resume printing file to SD card e.g. every layer.
From M413 - Power-loss Recovery documentation I quote:

Enable or disable the Power-loss Recovery feature. When this feature is enabled, the state of the current print job (SD card only) will be saved to a file on the SD card. If the machine crashes or a power outage occurs, the firmware will present an option to Resume the interrupted print job. In Marlin 2.0 the POWER_LOSS_RECOVERY option must be enabled.
This feature operates without a power-loss detection circuit by writing to the recovery file periodically (e.g., once per layer), or if a POWER_LOSS_PIN is configured then it will write the recovery info only when a power-loss is detected. The latter option is preferred, since constant writing to the SD card can shorten its life, and the print will be resumed where it was interrupted rather than repeating the last layer. (Future implementations may allow use of the EEPROM or the on-board SD card.)

This means if you cut the power you can resume the print layer, the only problem is that the part must remain attached to the plate, if it comes loose it is hard to resume printing. This feature is now commonly found on printers these days.
The regular pause and resume functionality of the printer will not work when the power is cut over night, i.e. no recovery file is written in such a case.