Both Nintendo's Consoles and Portables have a "System Transfer" feature, which lets you transfer all data "upwards" (to a next gen system) or "sideways" (to an identical system).
So to answer your first question, yes, via system transfer, you can transfer ownership of the purchase, which will let you download the game from the Nintendo E-Shop again.
Note that System Transfers are One-Way and Permanent!
After completion, the "sender" system is formatted, which means if there is an error, you're out of luck (Get on that, already, Nintendo!)
For your second question, system transfer is not applicable, since (presumably) the 3DS can't be turned on. In this case, I think your best bet is to call up Nintendo Support and explain the situation, as you're no longer able to handle this manually.
Finally, for digital copies of purchased games, no, there is currently no way to share them with friends on another system.