Lines are separated by line breaks. The tool remembers each line it has already kept and skips a later line with the same key. Order of the first copies does not change.
Trimming removes spaces at the ends before the comparison, and the kept line is the trimmed one. Ignoring case compares a lowercase copy but keeps the original casing of the first line.