A preposition is a word that indicates the relationship between a noun or pronoun and other words in a sentence. Preposition (Pre + Position) means that which is positioned before. So, a preposition is usually placed before a noun or pronoun it governs. Example: The ball is kept on the table.
Prepositions are words that provide information to the reader. This information can include where something takes place (such as 'at' the store), when or why something takes place (such as 'before' dinner), or general descriptive information (such as the girl 'with' the cool tattoo).
Preposition indicates the relation between two parts of a sentence by linking nouns, pronouns and phrases to other words in a sentence. The reader would not know key and necessary facts about a sentence without a preposition.
There are hardly any rules as to when to use which preposition. The only way to learn prepositions is looking them up in a dictionary, reading a lot in English literature and learning useful phrases off by heart.
Here are some examples of commonly-used prepositions: about, above, below, behind, beside, for, from, in, on, out, to, from, at, within etc.