Understanding, Formally Characterizing, and Robustly Handling Real-World Distribution Shift