I used to work in law enforcement relations for a major cell phone provider. It is easy to not be detected: Use a burner phone. Regarding turning off your phone, that will probably do the trick, but if you are up to something so evil that the powers that be will pull out all the stops to track you, it’s probably best to use the burner.
But this is a great answer: https://www.quora.com/Is-it-true-that-the-location-of-turned-off-mobile-phones-can-still-be-tracked-if-the-battery-is-installed