Three legs ensures that all of the legs will make contact with a floor, even if the floor is uneven (with four legs, the height of each leg would need to be adjustable to provide stable contact for all legs).
Regarding two legs on one side and one leg on the other (vs. two legs in front, one in the back), it probably also has something to do with the stability of the shelf...since the width is much wider than the depth of this shelf, there's probably less chance of the shelf tipping...