you use it when the next word would require the direct object but is a pronoun. so, instead of et ani (which you can't use) you combine them together אותי.
https://www.pealim.com/dict/2710-et/ In Hebrew direct objects can be either indefinite (a waiter, a letter) or definite (the waiter). In this article we are focusing on the definite direct object. A definite direct object is always preceded by the particle אֵת (pronounced like the 'et' part of bet).Jan 22, 2014 https://blogs.transparent.com/hebrew/a-look-at-grammar-the-direct-object/
Take the verb "to eat" I eat bananas. Bananas answers who what or when. "I eat-'-- what? Bananas! This is the Direct Object. Take the verb "to give" I give you the bill" 'you' is the Indirect Object because you are receiving something and 'the bill' answers 'what' and is the Direct Object. 'I' as the creator of the action is the Subject.