Normally whenever we turn off our computer we do it from the operating system, responsible for sending the corresponding tasks to the hardware for its proper shutdown, however, for different reasons such as a power outage or a computer lock may not run the tasks for proper shutdown.
To what extent is this dangerous?
Generally with a light cut the hardware is not damaged, although what can be damaged is the software. Most of the occasions when the light comes back you can restart the computer and we can continue working with it without problems however, it may happen that if the hard disk was working just at that time the partition table is corrupted and we lose access to all the data stored in it. Also, as an intermediate point, it is possible that only the entries of the registry and the boot of Windows executed at that moment are damaged, so that with a repair of the system or a formatting we will be able to continue using our system without problems.
The same thing happens when we turn off the computer from the main button or the power supply switch. It is always recommended to use the software to disconnect the hardware so that it can terminate all open processes safely, download memory and cache loaded files and be able to disconnect the current without problems.
However, for example, if our computer crashes, we must take the risk since the other options are not viable.
All these risks are reduced considerably with the use of SSD storage devices since, unlike traditional hard disks, they do not have a head that can physically damage the hard disk by not returning to its original position before disconnecting itself incorrect.
Under normal conditions, the rest of the physical components would not have to be damaged by a bad shutdown, although some of them may have to perform an initial check when rebooting (eg BIOS).
We must differentiate between power outage and surge. If we are in a zone with great variations of current it is advisable to install a UPS or uninterruptible power supply system to avoid that a sudden cut of light can generate some of the previous errors and that a rise of current can literally burn our hardware.