
(a) Either by accelerating too much for a given coffee level (fluid statics)
(b) Or, through more complicated dynamical phenomena:
- Initial acceleration sets an initial sloshing amplitude, which is analogous to the main antisymmetric mode of sloshing.
- This initial perturbation is amplified by the back-and-forth and pitching excitations since their frequency is close to the natural one because of the choice of normal mug dimensions.
- Vertical motion also does not lead to resonance as it is a subharmonic excitation (Faraday phenomena).
- Noise has higher frequency, which makes the antisymmetric mode unstable thus generating a swirl.
- Time to spill depends on "focused"/"unfocused" regime and increases with decreasing maximum acceleration (walking speed).

Lessons learned from sloshing dynamics may suggest strategies to control spilling, e.g. via using
- a flexible container to act as a sloshing absorber in suppressing liquid oscillations.
- a series of concentric rings (baffles) arranged around the inner wall of a container.
Text via Walking with coffee: when and why coffee spills (pdf)
More information on physics buzz blog
Paper: Mayer H.C. & Krechetnikov R. (2012). Walking with coffee: Why does it spill?, Physical Review E, 85 (4) DOI: http://dx.doi.org/10.1103/physreve.85.046117 (pdf)