“That” and “which” are relative pronouns that begin relative clauses by replacing or referring to an action, idea, place or thing previously stated in the sentence.
When referring to a human being (or an animal with a name), relative clauses should start with the word “who” or “whom.” (See Who/Whom.)
When referring to an object or nameless animal with an essential (also known as “restrictive”) clause — one that can’t be eliminated without changing the meaning of the sentence — relative clauses should begin with the word “that.” Essential clauses do not need commas.
When referring to an object or nameless animal with a nonessential (also known as “nonrestrictive”) clause — one that can be eliminated from the sentence without changing the basic meaning — relative clauses should begin with the word “which.” If nonessential clauses appear in the middle of sentences, they may need to be set off by commas.
A simple test: Once your sentence is written, try reading it without the clause. If the sentence still means about the same thing, your clause should be introduced by “which.” If taking out the clause changes the meaning drastically, it should be introduced by “that.”
Right: The memorial celebrates the soldiers who died. (Essential: There are many soldiers, but only some of them died. The memorial celebrates them only.)
Right: The memorial celebrates the soldiers, who died. (Nonessential: The memorial celebrates all the soldiers, and all the soldiers are dead.)