Your question should be, "When do we have to separate phrasal verbs?"
This is a lot more complex than you'd like it to be. Some phrasal verbs don't separate, and some do. Some phrasal verbs take an object, but don't separate. You need to learn the rules for each new phrasal verb.
If a phrasal verb is separable, you must separate it if you use an object pronoun: me, you, him, her, it, us, them. You can say "take off your hat" or "take your hat off", but you must use "take it off" ("take off it" is simply wrong).