A watchdog timer is a piece of hardware, often built into a Single Board Computer (SBC) or embedded PC that can cause a reset when it determines that the system has either hung up or is no longer executing the correct sequence of code.
A properly designed watchdog mechanism should, at the very least, catch events that hang the system. In electrically noisy environments, a power glitch may corrupt the program counter, stack pointer, or data in RAM. The software could crash, even if the code is completely bug free. This is precisely the sort of transient failure that watchdogs will catch.
Bugs in software will cause systems to hang, therefore it is better to fix the root cause rather than relying on a watchdog timer. In complex embedded systems it may not be possible to guarantee that there are no bugs, however by using a watchdog you can prevent those bugs from hanging the system indefinitely.
A good watchdog system requires careful consideration of both software and hardware. Make certain to decide early on in the design process how you intend to use it and when a failure is detected you will reap the benefits of a more robust system.