Modern sabermetrics has been around for over a decade now, and one the earliest advances of the movement was understanding how lineups worked, and how to make them better. While traditional orthodoxy had your speedy player first, best hitter third, and slugger fourth, the actual numbers bear different results.
In short, a manager wants their best hitters to be first, second, and fourth in the lineup, namely with the goal of giving your best hitters the most plate appearances. The biggest misconception is that speed above all is most important at the first spot; in fact, it is on-base percentage.