Here's why most automation efforts fail — and what actually works.