Most times it’s just a matter of asking yourself: am I writing about the location of an object (there), am I writing about the owner of the object (their) or am I writing about a group of people (they’re)?