How does intermittent fasting work and is it safe for everyone to try?

How does intermittent fasting work and is it safe for everyone to try?