Fail Safe is a fairly broad term in controls and deals with the hardware as much as with the PLC. General you design the system so that when hardware is in the "safe state" the input to the PLC is high, that way if a power supply dies or a a wire breaks the PLC input will go low and alert the PLC that the machine is not healthy.
When sending signals out of the control panel to the field devices you want to design in such a way that if power is lost on the control panel the signals default in such a way that the field devices are sent signals telling them to go their safe state. This can be done by carefully deciding whether to use the NO or NC contacts of a relay to control a device.
Once the hardware is fail safe the program should be made as fail safe as possible. This involves writing logic to put equipment in a safe mode when problems crop up. Safe mode does not always mean stop the equipment - if you have an exothermic process underway you don't want to stop the cooling water flow or close a valve in the cooling water line.
There are many techniques for deciding when a system has incurred an error. Say you want an event to happen only if a certain valve has opened - if both inputs are available you should not only look at the ZSO to see if the valve is in the opened state, but also look at the ZSC to make sure the vavle is not in the closed state. Compare the Aux contact of the motor starter to the motor start command and make sure a motor did in fact start (or at least the contactor pulled in - this does not mean positively that the motor started). There are a lot of other tricks that you learn as you develop your programming skills, but this is the general idea.