Sometimes, the word 'that' to introduce a dependent clause is optional. For example, these sentences both make sense with or without 'that':
Long books [that] religious people like tend to be Bibles.
Water tanks [that] fish need are spacious.
... whereas in these sentences, 'that' is mandatory and the sentence is ungrammatical without it:
Those that are rotten must be thrown away.
Cars that break down endanger pedestrians.
I can't quite put my finger on the rule which determines when 'that' must be used. What is it?