Whenever you are operating under a clearance—whether on the ground or in the air—you have to inform ATC of any deviations. However, other concerns—controlling the aircraft—take priority. So you actually inform ATC as soon as you can safely do it, after the fact.
When you are cleared to take-off, you are implicitly cleared to abort, when you are cleared to land, you are implicitly cleared to go around and in any other circumstance you have enough free space around you that you won't run into anybody else (properly controlled) if you take some time.
So when you are taxiing along and your engine sucks something up and quits, you first slam on the brakes—because you definitely don't want to hit anything—then you do the memory items from the engine fire or failure checklist and only then you key the mic and announce something like “Tower, N123AB stopped on taxiway K due to engine failure. We might have ingested some foreign object.” (and if the fire alarm came on, ask for the firefighters). The next aircraft behind you either sees you well enough to stop in time, or (if it's really bad fog) has a lot of distance.
The worst case is probably emergency descent, where when you retard to idle and deploy the spoilers, you'll be through the next assigned level 1,000 ft below in about 10 seconds, but that only happens up where everybody is required to have a transponder, so you can probably trust the T-CAS for a bit.
For a real anecdote, I'd quote How It Flies:
I didn’t like what I was imagining, so I pulled the throttle to idle and stomped on the brakes. I also keyed the transmitter and said “Tower, Two-Four-Kilo is gonna hold our position for a moment”.
Read? Stomped on the brakes without having any confirmation that he should—because he had an—absolutely correct—hunch that the other guy would bust his clearance and land on the runway he was cleared to take off from and not the parallel one he's been assigned. You first control the aircraft as safely as you can, and then tell ATC what is going on.