When we took over the codebase, it was 50-50 whether or not we'd really continue with it long term or just fix a couple important bugs and work on porting to something new. Then we managed to hire a couple of the core devs from the product and decided to keep it.
We were lucky that they did a good job with the escrowed code and had everything we needed to build the software on day one.
>And for how many of those that do is it actually an optimal use of resources?
That's impossible to answer -- depends on how hard it would be to port to another product to fill the need (assuming you can find such a product), or write a new system from scratch to do what that product does.