Like adjectives and adverbs, prepositions help to add 'colour' to our phrases and apply to the noun that follows them* e.g.
'He ran under the arch'
'She slid the book across the table'
*I say 'noun that follows them' this is usually the case, but there are exceptions "Who are they looking at?" is a case where the preposition follows the noun.
In formal English, which you should use for your assignments, the preposition should come before the relative pronoun, e.g.
The student to whom the scholarship was given was delighted.
In conversation it can come at the end of the clause, e.g. The student who the scholarship was given to was delighted.
A preposition and pronoun can be followed by an infinitive. (This gives a very sophisticated sentence.)
The students have a quiet area in which to study.
It is helpful to have a classmate with whom to discuss assignments.
Which can be used after a preposition and before a noun in some sentences.
You might pass, in which case you won't have to repeat the year.
in = preposition
which
case = noun
I phoned at nine o'clock, by which time he had left.
by = preposition
which
time = noun