For example:
This is a house. He lives in it.
-> This is the house which he lives in. (two sentences are combined into one using "which")
= This is the house in which he lives. ("in" is moved in front of "which")
= This is the house where he lives. ("in which" is replaced with "where", its equivalent)