It's all about the externalities

Yesterday I was speaking with a friend and she asked how long it would take to do a certain technical task.  I paused for a moment trying to decide which number to give her.  The time required to do the task itself is short. However, there are lots of little places where external issues could bog down the process.  The micro-sd card, adapter or usb port could be bad, the wifi signal could be weak or intermittent or the program I am using could have just been automatically updated with buggy code.  All of these (and more) have happened to me at one time or another.
As a freelancer for over a decade, I have gotten very good at estimating how much of my time a task will take.  But perfecting the art of estimating externalities still eludes me.  I can pretty much guarantee that in any given project, at least one unexpected issue will arise.  However. how does one factor in time for the unexpected? However, no matter how many times I have done a specific type of project, I struggle to predict exactly what will go wrong and how long it will take to resolve the issue. I try to be transparent and upfront about the inevitable hiccups.  But that too requires finesse.  Listing too many potential issues can make me seem incompetent.  Listing too few can leave the client open to unexpected surprises (even if that phrase feels redundant to me). When the economy is good, clients are generally amenable to adding some contingency time into a contract.  When the economy is tight, clients, reasonably, want a firm time estimate.
I have also been on the client side of the table a number of times.  You would think my own experience would make me more sympathetic to the challenges consultants face when estimating their time.  And it does, but only to a limited degree.  I tend to be more empathetic when I understand the process behind what I have contracted with someone to do.  When the task is completely outside my knowledge or experience, I feel my cynicism creeping in.  Not because that individual is untrustworthy. But because I have no idea if he/she has budgeted too much or too little time for externalities.  That is why I do my best to educate myself about the work I am looking to contract out before seeking bids.
One recent example involves a broken dishwasher.  A few months ago my dishwasher stopped draining.  I did not have the vaguest idea whether the problem was terminal or not.  I did some basic internet research and learned that the most common cause for this problem was a broken drain motor.  I also learned that it was almost always more cost effective to replace the dishwasher than to repair the motor.  I knew the dishwasher is over 8 years old, so its value had been fully amortized.  A friend recommended a plumber who took a look at it and diagnosed the problem as a broken drain motor.  More importantly to me, he explained how he determined the source of the problem.  It all jived with the information I had read and he immediately earned my trust.
When it came to his estimate, he provided a range based on some contingencies that he spelled out to me.  He had already earned my trust and had proven to be transparent about the process so I felt comfortable hiring him without seeking additional bids.  His services may not have been the cheapest but I valued his transparency and communication and was willing to pay a possible premium for those assets alone.
My experience with the plumber confirmed for me that the best way to factor-in the potential costs of the unknown is to educate potential clients and be as transparent as possible.  That approach may not work for everyone. But it works well for me, regardless of what side of the table I am sitting on.