It depends on the shop. I found that they all restock after a certain time period, but if you're looking for something specific from a specific merchant, then it's probably a good idea to save right before you enter the shop to talk to the merchant and reload if the merchant has nothing good. I got a lot of spellbooks from Blake this way.