1) These prepositions take the dative case:
aus, außer, bei, mit, nach, seit, von, zu, gegenüber
2) These prepositions take the accusative case:
bis, durch, entlang, für, gegen, ohne, um, wider
3) These prepositions take either the dative or the accusative case depending on the context:
an, auf, hinter, in, neben, über, unter, vor, zwischen
As a general rule, use the accusative case if movement is involved and the dative case if there is no movement.
For example:
a) der Mann geht über die Brücke (The man is going over the bridge)
Movement involved = accusative case
b) die Katze ist unter dem Tisch (The cat is under the table)
No movement involved = dative case
4) Some verbs contain a preposition and take a specific case. See this website for examples of verbs with prepositions:
https://en.wikibooks.org/wiki/German/Grammar/Prepositions_and_Postpositions