Mechanical failures occur because of a very wide variety of causes. After a failure, you'll need to analyze:
The initial design and any pre-build engineering.
Did the design incorporate correct building codes?
The Installation Techniques used in the building process.
Material Stress during the use of the structure.
Interaction with people--were modifications made?
Does this analysis need to be time consuming and expensive? Not always. A few years ago we worked on an insurance case where a small structure had failed causing property damage. A carport had fallen on a car and the owner filed a claim. When we inspected the site, we found a number of issues and a very simple report clearly placed liability.
Previous occupants of this particular dwelling had built a carport without adhering to building codes. The current occupants had installed a basketball backboard on this already marginal structure. The backboard created what is called "dynamic load," stresses on the structure that changed. The ball hits the backboard and the carport accumulates stress to the point of failure.
No appearance in court was necessary. The simple report met the client's needs and resolved the issue.