Amazon is the king of fast delivery—it pioneered the two-day shipping model customers have come to expect. But to stay ahead of Target and Walmart, it’s overhauling its distribution network.