There are 2 major rules when it comes to the use of prepositions.
The first major rule deals with preposition choice. Certain prepositions must follow certain words, and the correct preposition must be used to make relationships between words in the sentences clear. The second major rule deals with the prepositions place in the sentence. Prepositions must be followed by nouns, and prepositions can only go on the end of the sentence in certain situations.