|MadSci Network: Physics|
It all depends on which way around the magnets are. Each magnet has 2 ends, a north pole and a south pole, opposite poles attract each other and like poles push away from each other. So in this arrangement of 3 bar magnets N-S S-N S-N the middle one will move to the right. So in this arrangement of 3 bar magnets N S S the middle one | | | S N N will move left. However, in this situation N-S S-N N-S the middle one is pushed away by both sides and will move forward or back and here S-N S-N S-N the middle one will move to the side of the magnet with the stronger pole. The nearer the pole the stronger it is. Even though magnets might look the same they will have different strengths as indivual magnets lose their magnetism at different rates depending on how they are treated.
Try the links in the MadSci Library for more information on Physics.