The short answer is 'it depends'.
Any software you create is intellectual property (IP). The value of IP is whatever someone is willing to pay for it.
Significant pricing factors usually include things like the quality of the product itself (end user experience, utility, sophistication), the quality and documentation of the source code, the platform/language of the code, and amount of code (i.e. how hard would it be to just create it from scratch).
Selling the software is at least as tricky a pricing it. It would largely be a matter of identifying and attracting someone who would see value in your IP. Gary mentions competitors. There may also be vertical players (like industries), other software publishers, or even startup entrepreneurs like those who hang out here.
As Gary and Keith have already said, maybe a startup's code and other assets can be sold.
In principle there is nothing special about selling the sourcecode, copyright, and any other rights to a codebase developed by a failed startup. You'll need to decide between selling the whole company, and selling just the product. In both cases the trick is to find buyers and agree on a fair price -- the market for the sale of very small companies is not that well developed. Flippa.com is a site for selling websites and small web businesses. eBay has sometimes been used for the same thing. Beyond this, most regions have business brokers who sell businesses of all kinds, but typically there has to be a certain minimum transaction size (say ~1 million USD) before a business broker will be interested.
To make this happen, you would need to get creative. Think about what value your customer base has, think about who could derive value from owning your tech -- maybe your largest customer, a service provider who can support your customers and bill by the hour, etc.
If your start up fails for whatever reasonWell, if the company has failed, it gets harder. There can still be value in the software, current customers and other assets, but you'll need to think about what the buyers upside is.
Your software may have value to someone else depending on many different conditions. Does it do something useful that other firms (your competition) might want? Is your software well written and thoroughly documented? Is your software written in a language (platform) that other firms can use? Would your software add value to another firm that does not compete with yours?
Only you can answer these questions. One way to start looking for possible buyers is to identify your competition and approach them.