You asked a broad question, and many factors come into play.
First, you need to understand why capacitor takes place, and what, from physics point of view, happens to all components involved.
In your example decoupling capacitor "protects" U1 chip from noise generated by the power supply and other components connected to power rails. And, at the same time, it protects other components from noise generated by the operation of U1.
Your task, as designer of the circuit and layout, to ensure as many components as possible are protected from interference. In simple, low frequency circuits like yours, having only two components, it may not matter where you place cap to, but I would anyway recommend to place it "before" the chip, or exactly between its pins if possible. In more complex and sophisticated circuits you may place capacitors between pins, or between integrated circuits - this all depends on noise frequency which could be generated by operation of the IC (or any other component) and possible interference between these components.
And last, but not least. Be careful putting decoupling capacitors with large difference in their values close to each other. I did not experience it yet :) but I heard that in unfavorable situations capacitors and board may form oscillation circuit which may affect power quality badly.