The food delivery app is losing money, battling rivals, facing lawsuits — and trying to go public. What could go wrong?