They are supposed to leave battle when they are low on health, but what qualifies as low health, or can they TP out? Will they die if they're trapped in a mob and can't escape? If so, what happens? Are there any other circumstances in which they will die? How long are they gone? Will they be in town if they've gone away, and can you go back to town to pick them up, or must you wait either way?
No, they don't die. If they go to 0 health, they disappear from the battle and reappear sometime later (even if the same fight is still going on).
It was easiest to test this with the skeleton king. My templar "died" a couple of times and came back 30 seconds or something like that later (Although that number is just an estimate, I haven't measured).