Your ship is insured for a certain amount of it's total value (including modules).
The amount it is covered for depends on when you bought ED
Alpha - 97.5%
Beta - 96.25%
Release - 95%
The remainder (the excess), you are responsible for covering in the event of ship destruction, this is summarised under your stats panel (the right hand side panel in your cockpit).
NOTE - Added to this excess is the sum of any outstanding bounties on your head at the time of ship destruction, this can significantly increase the amount required to restore you to your former state.*
[SUB]*This may be subject to the 50% additional costs usually incurred when paying off a bounty on yourself, I don't know the answer to that but it's worth making an allowance for.[/SUB]
When your ship is destroyed, an options screen will appear, allowing you to select either a basic sidewinder (if you don't have the funds to cover the excess) or your old ship with all or some of it's previous load out. You can uncheck any modules that you cannot afford to cover at this stage.
You may also choose to take out a loan (maximum 200,000 cr) if you are a small amount short of money to cover the excess. If you choose this option then a percentage of your subsequent earnings will be taken to pay this back, until the loan is repaid in full.