How do I calculate the cost of a 3D print once it's done? How do I determine how much an individual print costs?

I'd like an answer including support material, failed prints, and (ideally) wear and tear / printer maintenance costs.

To clarify, I'm not asking how to predict the cost before printing, but rather how to calculate the actual cost after printing. Though predicting the cost beforehand is useful as well.
For FDM printing: 

Both Cura and Makerbot Desktop (and perhaps others I'm not as familiar with) will give you a preview of both the length and weight of your print, including supports/rafts. Once the print is done you can weigh it on a kitchen scale.

PLA Filament currently runs about \$23/kg on Amazon, which works out to \$0.023/g. Multiplication can then give you a good estimate of materials costs for a print.

Only experience with your specific printer will give you an idea of how often you're going to hit a failed print, and how often you're going to need to replace parts. For wear and tear you could try using a depreciation model of 2-3 years, but that's only an estimate.