In this particular case you ask about, "-하지 않다", This is the case of (as I dub it) "Intense Consonance Phenomenon." By "Intense Consonance" I mean 격음(激音).
ㅎ sound and ㅈ sound come together to create ㅊ sound.
As for your second question, the "Voice vs. Voicelessness" comes into factor. There are two cases:
- Case of Voice: If the support consonant of the stem word is voiced, e.g. ㄴ; ㅇ; ㅁ; ㄹ, 치 is used.
- Case of Voicelessness: If the support consonant of the stem word is voiceless (consonants other than the ones I listed above), 지 is used.
Note, however, that this "Voice vs. Voicelessness" is only applied to cases where the original form of the word ends with "하다." What do I mean by this?
As an example, here is the word "서슴" (which means "to hesitate"). As I said above, it would seem correct to use 치 to create the word "서슴치 않다" ("to not hesitate), since the support consonant of the stem word is ㅁ, one of the examples I've listed above. But this case is different; the original form of the word "서슴" is "서슴다." That particular suffix is NOT "하다." Here you would use the phrase "서슴지 않다."
Conclusion:
- If the original form of the word does NOT end with "-하다," "지" is used as suffix.
- If the original form of the word does end with "-하다," there are two cases:
- If the support consonant of the stem word is voiced, "치" is used.
- If the support consonant of the stem word is voiceless, "지" is used.