The fact that there is a choice at all upset prescriptive grammarians in the 18th century, and they spent a lot of futile energy trying to get rid of it. The usual line was to insist that that goes with restrictive relative clauses (as in the example above) and which goes with nonrestrictive ones (usually shown in writing by commas around the relative clause, and by a separate tone group in speech). So, the recommendation we get in traditional grammar is illustrated by:
The exam, which was taken by class 3, was difficult. (The speaker is talking about only one exam: nonrestrictive, nondefining)
The exam that was taken by class 3 was difficult. (The speaker is talking about several exams, one of which was taken by class 3: restrictive, defining)
Fowler spends six pages trying to sort things out in his Dictionary of Modern English Usage (see the entry under THAT, REL), before throwing in the towel. It's a lovely instance where we see his underlying prescriptive temperament at odds with his awareness that usage is complex and divided:
'Relation between that & which. What grammarians say should be has perhaps less influence on what shall be than even the more modest of them realize; usage evolves itself little disturbed by their likes & dislikes. And yet the temptation to show how better use might have been made of the material to hand is sometimes irresistible. ... The relations between that, who, & which, have come to us from our forefathers as an odd jumble, & plainly show that the language has not been neatly constructed by a master-builder who could create each part to do the exact work required of it, neither overlapped nor overlapping; far from that, its parts have had to grow as they could.'
He goes on to recommend an ideal solution, while acknowledging that it won't work:
'if writers would agree to regard that as the defining relative pronoun, & which as the non-defining, there would be much gain both in lucidity & in ease. Some there are who follow this principle now; but it would be idle to pretend it was the practice either of most or of the best writers'.
Indeed. And when we look at the way modern corpora present the evidence, we can easily see the absurdity of the recommendation when it comes to restrictive clauses (the wh- set is definitely the preferred choice for nonrestrictives). Both grammatical and stylistic factors are involved. Here are some instances where that is preferred over which:
- in cleft sentences: I saw the car that was involved in the accident.
- in a noun phrase containing an ordinal number: the first incident that took place was recorded on film.
- in an indefinite noun phrase: Any letters that are received after Friday will not be read.
- in a noun phrase containing a superlative: The circus was the biggest attraction that had appeared in the town for many years.
That provides the solution when the antecedents are a mix of human and nonhuman: I saw the woman and the dogs that were rescued.
Similarly, that saves us worrying about whether we should use who or which in cases like The foetus -- is allowed to come to term.... And if you are uncertain about the distinction between who and whom, that helps you out too.
Among the stylistic factors, we need to note several points:
- which is weightier, taking up more visual space than that; that is often described as being a 'lighter' word to use, and preferred as sentences become more complex (or 'dense') in structure. (It can also often be informally omitted, of course.)
- considerations of euphony and ease of articulation affect both forms: people find the car that was... slightly easier to say than the car which was..., and the car which those people bought... easier than the car that those people bought...
A particularly important stylistic effect is to avoid repetition. If one of the words is already being used, people try to avoid repeating it: I would never write That is the answer that I prefer or Which is the answer which you prefer? Speech is less predictable in this respect.
It's difficult to generalize, therefore. But, on the whole, that is considered to be more informal than which, and corpus studies show that it is certainly far more frequent in conversation and in fiction, whereas which is far more often used in nonfiction and formal speech such as news reporting. But the prescriptive tradition continues to influence. If a style guide recommends a usage, many will simply follow it. This is probably one of the reasons why the preference for which is so much more noticeable in American English, because writers have been influenced by the Chicago Manual of Style, following the Fowlerian line.