If you are referring to DC power, then voltage supervisors are the answer. 5V monitors (or 3.3V) reset the circuit when the voltage drops below a threshold. The threshold is high enough that your circuit will continue to operate correctly.
For example, the MCP809, from Microchip, or MAX809 from Maxim, or the DS1233, from Dallas (owned by Maxim now) will provide ultrafast response when the voltage drops below about 4.75V.
Check the manufacturers' websites for voltage or microprocessor supervisors.
There are many other companies that make them, most of them compatible with the ones from Maxim.
So I suggest you first go to their website and check them out, them look for alternates.
If AC power failure is the problem, then you can also rely on these circuits, since they will reset your circuit when the 5V eventually drops.
If you really need to supervise the AC, then you need to rectify/ filter an AC sample (from the secondary of a transformer, for instance) and use that to tell your circuit the power is failing. But your DC power has to have enough capacitance to keep your circuit going for a longer time than your AC sample filter delay, so that the circuit can do something meaningful to prevent unreliable operation.
A typical value for this so-called hold-up time (time the DC is still valid) is about 20ms.