Possible causes:
Loose power cable
Faulty power supply
Battery issues (on laptops)
Fixes:
Ensure the power cable is fully plugged into both the outlet and the PC
Try a different wall socket
Remove the battery (if removable), hold the power button for 10 seconds, reconnect, and power on
For desktops: check PSU switch (at the back) is flipped ON