Rules for preposition usage include that a preposition must have a noun or pronoun as its object, and some idioms require specific prepositions with certain words. While prepositions usually shouldn't end a sentence, there are circumstances where they can.
A preposition indicates a relationship between its object and the rest of the sentence. In addition to pronouns and nouns, other types of words can be the object of a preposition if they function as a noun or pronoun in that sentence. For example, although "run" is a verb, it is the object of a preposition in the sentence "I like to run," because it functions as a noun.
Idioms include the expressions "capable of" and "able to." No other preposition works in those idioms.