Safe mode on a phone is similar to safe mode on a computer. It causes your device to only boot up the parts of it that are essential to functioning. It can be used to identify and isolate device problems, particularly problems from an app/program that is interfering with the device.
For most phones, you can get out of safe mode just be restarting your phone.