How to save money by booking hotels online

Imagine the following situation: You arrive to a new city without any reservation and you head out to the nearest hotel/hostel in order to spend the night there and you are surprised to realize that the walk-in price is actually much more expensive that the price found online in...