Yes, the basic forms of the demonstrative pronouns do change based on gender, number, and case. See, for example: https://en.wikipedia.org/wiki/Czech_declension#Demonstrative_pronouns. But the tam-, -hle and -to "add-ons,""when they're used, remain the same. (By which I mean to say that those bits themselves don't change, only the forms to which they're added change.)
Regarding demonstrative adjectives; in simple form (ten, ta ,to) =That. With prefix tam- also= That. With suffix -hle or --to =This. But we also have a prefix tamhle-. Is there any reason for the various preffices and suffices or are they interchangeable without changing the meaning apart from This and That?
It just happens that people start to use various variations and some become standard. There are many more that are non-standard (colloquial). Hle comes from hlědět and basically means "see". Tamhle is almost like "tam hleď" which means "look there".
Hleď isn't really used much, it is archaic, but survives in military commands and in literature and films.