Just thought I'd add - speed affects the order of lots of things. The faster pokemon will attack (except when out-prioritized or under trick room), switch out, get leftovers recovery, and take sandstorm/hail damage before the slower pokemon does each of those things (like, faster mon takes...