Step 1 is using a strong bike lock like the Kryptonite New York 3000. It'll be expensive and heavy but most thieves will look at it and pick an easier target. Don't skimp on this!
There's no point in an expensive lock if you use it incorrectly. Always lock through the frame and rear wheel. Crazy how many people I see locking just through wheel and thief just removes wheel!
You also always need a cheaper, secondary lock that goes through frame and front wheel. The 2nd lock should be a different type as thief probably only has tools to crack one type of lock.
A strong primary lock and secondary lock is the cornerstone to a good locking strategy. You keep both your wheels safe and stop all but most determined thief.
Ideally, lock your bike with the lock away from the ground, as it will make it harder for the thief to leverage for attack. It's all about making life harder for the bad guys.
Never: Lock your bike to an object that it can be lifted over (thieves have been known to remove sign posts to get to bikes).
Never lock your bike to a weak object that the thief can just break. Old iron railings are often not very sturdy. It's better to walk a little further and find a solid object.
When you leave your bike, take any accessories with you. Your bike lights, bike computer and panniers. These are easy pickings for thieves.
Using these techniques I've not had a bike stolen in 5 years in London! (Where bike theft is ripe!)
Bonus: an extra tip is to use a component locking system such as Pinhead. This means thieves can't easily remove your bike components.