When to use that's and when to use it's?

That's and it's are contractions of that is and it is.

You are able to tell yourself which sounds best if you expand them as such. One will flow while the other may make a clanking sound.

Either may be used in most cases with little difference. The purist may say that the that refers objectively to that which has been done, as a thing or object. Using it will be more in hand in the present.