Louis,
"Which" is used as a relative pronoun, Basically that means that the word "which" is replacing a noun. This is done not to repeat the same word twice.
For example:
I will visit Brazil tomorrow, from which I will bring many presents.
This is to avoid saying:
I will visit Brazil tomorrow, from Brazil I will bring many presents.
So you just have to pay attention to the preposition that would go with a noun and use "which" to replace the noun.
Examples:
Water has to be heated to a certain point, at which (at a point) it will start boiling.
We have to enter the house, out of which (out of the house) those men came out.
This situation has caused me a problem, which (this problem) I cannot resolve.
I hope this helps.