I usually answer this question more than five times per day, and as I was taught at university, it all depends.
How much do you run?
This is always the first question I ask the customer. The amount of kilometers the shoe can take is more often the deciding factor when deciding a shoes lifetime. A normal long distance trainer is said to withstand from 800 to 1000 kilometers of regular use, but many people use them for a lot more.
Although walking puts less amount of stress on your shoe, daily use can significantly decrease its lifetime. This is one thing that many people don't realize and that people don't put into the calculation. There are cases where a customer says he/she has only run 200 kilometers in the shoe in 2,5 years, and the shoe is completely broken down from walking.
Let your shoe rest, and it will last longer!
A running shoe can need up to two days to get completely dry after a run, and many people tend to use them before that time is up. Letting a shoe rest in between runs is important when trying to increase it's lifespan, not only because of sweat or rain, but also because the foam sometimes need to relax and expand again. Alternating between running shoes increases the shoes resting time between training sessions, and it's one of the main reasons why we advocate having several different running shoes in mix, if you work out regularly.
The different soles
A running shoes consists of different soles put together; a top-, mid- and bottom sole. A common misconception I face from customers is that the bottom sole can be used to indicate if you need a new shoe. The problem with that hypothesis is that the bottom sole usually lasts a lot longer than the midsole, thus leaving the shoe significantly less cushioned during the last part of its lifespan. Having two running shoes can help in this situation as well. You'll quickly feel if a shoe is worse than another, while if you have only one shoe it's hard to compare.
When should I buy new running shoes?
Realizing when it's time to change to new running shoes is a very difficult process if you are irregular in your training regime or if you only have one pair of shoes at the time. Counting kilometers is one way to go, but if you have more than one pair, than this can be difficult.
Inserting your shoes in a GPS app like Strava can be of great help in these cases. To the right you'll see the shoes I run with at the moment. I know exactly how many kilometers my shoes have traveled so far, thus making it very easy to see when I need to replace a shoe.
There are so many variables when using a running shoe, and in order to change running shoes at the correct time I would strongly recommend having several pairs that you can compare at all times. If not, then try to count your kilometers so that you don't end up ruining yourself with a worn out shoe.