the subject of a relative clause:
The man who phoned a moment ago wanted to speak to Susan.
the object of a relative clause: The second-hand car
which Paul bought last year has not broken down yet. (which
is the object of bought)
when the relative pronoun is the object of the relative clause, it can be
omitted: The second-hand car Paul bought last year has not broken down
yet.
the complement of a preposition. When the relative pronoun is
not omitted and placed after the preposition you can only use whom to refer to
people and which to refer to things:
The boy
with whom Jenny goes out is a very good sporstman.
The key with which I opened the back door yesterday is very
rusty.
When the relative pronoun is the complement of a preposition, it can be omitted.
Then the preposition must be placed at the end of the relative clause unless there is a time adverb. If there is a time adverb, the preposition is placed before the time adverb.
The boy Jenny goes out with is a very good sporstman.
The key I opened the back door with yesterday is very
rusty.