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?
In both of the examples in which that is optional, the relative pronoun is the object of the embedded clause.
Long books [that] religious people like tend to be Bibles. [Religious people like long books.]
Water tanks [that] fish need are spacious. [Fish need water tanks.]
This is also allowed when the relative pronoun is the object of a preposition or another oblique argument of the embedded clause:
This is the boat I escaped in. [I escaped in this boat.]
In your other examples, the relative pronoun is the subject of the embedded clause:
Those that are rotten must be thrown away. [Those are rotten.]
Cars that break down endanger pedestrians. [Cars break down.]
English only allows you to omit that when it has been moved from a non-subject position in the embedded clause, and when it’s followed by the subject of the embedded clause. I suspect that the reason for this is the ease of comprehension on the part of the listener. A sentence like Cars break down endanger pedestrians, if it were grammatical, would be extremely hard to parse.