I've seen a few people open source their code for failed projects. Hadn't really thought about that, but it's something I'll keep in mind should I have an interesting, failed project.
The code still lives on my laptop and I reference pieces from time to time. I would have open-sourced it, but it included a lot of expectations about how the infrastructure was set up and would have taken a ton of time to generalize or properly document. The demand obviously wasn't there or else we wouldn't have gone out of business.
So there she lies. ~100,000 lines of code and 3 years of my life. May she RIP.
There's other sides to this as you won't want an ugly broken site up connected to your name. Case by case basis really.
There isn't a whole lot you could do with the code, i'd just say for most open source it and leave it quietly running, if feasible.
Everyone should release configurations at least. You can easily release those and those who say you can't either have really bad configuration or too lazy.
It would be a pleasant surprise if anyone got it running.
Etherpad (http://en.wikipedia.org/wiki/EtherPad) got sold to Google and the code was subsequently open sourced. It's since launched a number of hosting sites providing collaborative editing services. The source code lives on, there's even a node.js port available with a much smaller footprint (see Etherpad Lite (https://github.com/Pita/etherpad-lite).
Another good example is Mozilla. When Netscape crashed and burned Mozilla somehow managed to come out of the ashes.
Finally, some may decide to open source some or all of the code. As was mentioned, it's hard for others to use it, though, since it is rarely the case that a startup's codebase is going to be pretty and easy to get going and using, versus some nicely structure, re-usable OSS library.
In all other cases I've come into contact with the code just dies. Open sourcing would be nice, but that's obviously not a priority in a bankrupcy.