They can front run because they receive all of the order flow decimals of a second before the orders are executed. Let's say for example you saw (or your computer told you) that X market orders for Y shares to buy a stock just entered the market...your program tells you this is a lot of volume for this stock and it should push up the stock. Before any of the orders are executed your algorithm jumps in front and buys the stock and sells it a second later for a nice profit.
This is a very simplistic example.