when Something is necessary, usually when we are talking about rules and laws .
When something is not necessary when the speaker thinks it is necessary or important to do something
When something is prohibited.
when giving advice or to say something is a good idea.