In which situations should I use the former and the latter? Or maybe the two mean the same (and maybe the "so" is redundant)?
Example sentence:
Since you have low self-esteem he knew you'd be with him without a second thought. And you did (so).
In that particular sentence it would be more normal to say "And you were." This is because being with someone is a continuous event so you would use "were" which is the past progressive tense of the verb "to be". "Did" is the past tense of "to do" so would be used for an action completed in the past like "you did the shopping yesterday." If you need to refer to an ongoing action in the past, the past progressive of "to do" would be "you were doing" in which case you might use "so" or "just that" afterwards although it it's often redundant (which doesn't mean you shouldn't use it or it is incorrect, just not necessary).
"You did so!" sounds natural in the context of a childish argument:
You tattled!
I did not!
You did so!
In the context of the original post's example, neither "You did" nor "You did so" is natural. "You did so" is less natural. "You did" is incorrect because "did" is the past tense of "do", not "be".
The first sentence of the original post's example can be changed to use a subjunctive form of "do". (One possibility is to use "do him" in an informal way that means "have sex with him".) With that change, "And you did" would be an equally informal, natural, and grammatically correct follow-up.