A trailer caster follows the driving wheels easier than a leading caster is pushed by them. This means that if the caster gets in a small bump, if it is in the back of the robot it doesn't influence the direction of the robot as much as if it is in the front. The center of mass (weight) should be between the wheels at all times, but the more on the driving wheels the more traction the robot has. If the robot has a gripper and grabs objects, the weight of the object will move the center of mass so it may be too much over the driving wheels and the robot will tip over when stopping, if the caster is in the back.
There is the option of having both front and rear casters, one of them being mounted on a spring.
And of course there is the balancing robot with no casters at all. This is the best choice, but the hardest to do. A dynamically balanced robot is more stable than a statically balanced one. If something moves the center of mass, the robot adjusts it's position accordingly, re-stabilizing itself. Heck, it doesn't even need bumper sensors, if it bumps into something it pushes itself away from the obstacle to re-stabilize itself.