Hello!
Without knowing the specific device here are a few things you can try.
1. Simply restarting the device
2. If the phone has a removable battery, simply remove the battery and reinsert.
3. When the device is powered on, access the notification shade and see if there is an "end now" button to leave safe mode.
4. Try turning off the device and then power it back on holding the power button while also holding volume down.