Normally you use "legen" if the object afterwards is lying on something and you would use "stellen" if the object stands (upright) on another thing, eg:
er legt das Buch / die CD / den Bleistift / den Geldschein / den Keks auf den Tisch
er stellt die Vase / Flasche / Dose / den Topf / die Lampe auf den Tisch
er stellt das Buch ins Regal (if it stands upright afterwards)
er legt das Buch ins Regal (if its lying horizontally afterwards)