You are talking about verbs with prepositions - In these cases the preposition can over-rule the case the verb normally takes. So, your first action would be: Look up the preposition in the dictionary and check which case(s) it might rule.
"auf", as in your example, you will find:
Präposition mit Dativ und Akkusativ
Next, "auf" is a preposition of locality - These normally rule the accusative, if a motion is involved, and the dative, if a static location is denoted to.
Das Foto muss auf die Tür geklebt werden
refers to an action of movement - move something from here to there, here, to the door.
Das Foto ist auf der Tür geklebt
Is the result of a movement - Somebody was using accusative in the past to move it there, now it's there and won't budge, so dative.
This rule is easiest to understand with "in":
I'm driving into town
is definitely a movement towards something, so translates to
Ich fahre in die Stadt
I'm driving in town
Is not a movement towards something, but rather some limited movement within a confined area, so takes the dative in German
Ich fahre in der Stadt