Do the images from mirror image each take up a five foot grid square? If you have five images can you place three in front of you and one on each side, so any enemy in front has to hit an image? Or do the images appear randomly in any unoccupied square within 5 feet of you or another image?
Do the images from mirror image each take up a five foot grid square?
The text doesn't say, but it does say they cannot be further than 5' away from you or another image. Conceivably, they could be in a line of adjacent squares or an adjacent ring around your or any combination that meets that limit.
If you have five images can you place three in front of you and one on each side, Arguably.
so any enemy in front has to hit an image?
An enemy could still target you if you have an image in front of you. Since they aren't creatures and spell doesn't mention it, only a very generous DM would grant you soft cover (and cover does not stack in any case).
Or do the images appear randomly in any unoccupied square within 5 feet of you or another image?
I don't think the intent was to allow or prevent a player from choosing, rather, to simplify the adjudication. You have X number of images, and the DM rolls d(X+1), and if the roll comes up 1, you were targeted, otherwise an image was targeted. If you were hit, attackers could continue to attack you (without rolling) until your next turn, where you can take a move action to shift the images again. I think it would be perfectly acceptable for a DM to allow the placement to be specific, within the limitations of the spell, but it doesn't really change the outcome, and would take more time to deal with, so probably not a good idea unless it adds some element of fun.
The spell says that the images are "each within 5 feet of another image or of you", which strongly suggests that the images are located in grid squares. However the images are not solid, so it seems unfair to say that they take up a grid square. If someone tries to move into your image's square, your image can't stop them.
The spell doesn't say that you get control over how the images move. I would speculate that probably you can't control them, but your DM is the final authority here.
If you did manage to control the placement of your images, it might be a mistake to arrange them in an obviously defensive formation around your real self. I would expect that stupid enemies would attack the ones in front as you intended, but smart enemies could just walk past them and attack you directly. Better to keep them guessing.
The "walk past something you're certain is illusionary" mechanic is a bit weird, because we don't have any rules for what happens if you're wrong and the thing isn't illusionary after all. I would guess that it would provoke an attack, knock you prone, and end your turn. But that's a house rule and I don't have any backing for it.
The second line of the spell description states "The figments stay near you and disappear when struck". Later it states "these figments separate from you are remain in a cluster" so again depending on the about of images and the location of the caster, a line is doubtful if more that 2 images. It also states that you (the caster) "can move into and through a mirror image." This means that they can occupy the same space in a moment. It also states " figments may also move through each other." If the caster was hit, this would need to occur to then separate so that his image and himself cannot be followed. It would make sense that this occurs several times with several images as well as images with images, each round. This would be the only way to make it indistinguishable for an observer to tell image from real. Otherwise follow the merger and then it's 50/50 chance. Actually it does state "while moving you can merge with and split off from figments" to confound enemies that have located the real body. So the caster needs to move. This is the only control that the caster has, or it should be stated that spell randomly moves images through the caster, while moving, so really no control, but similar to how the images reflect visible wounds or fire damage, etc. So if merging happens often, with all images and casters, it would be difficult to remain in a line, nor have control especially still you don't require concentration and can perform other standard and move actions.
"These figments separate from you and remain in a cluster, each within 5 feet of at least one other figment or you." this line means that the maximum diameter of the cluster is five feet, the size of a square on the grid. Theoretically the images could be in the square adjacent to you, but I doubt this was as the spell was intended.
Additionally the text states that generally an attacker must randomly roll to strike the caster, as opposed to choosing which image to attack.
The figments therefore occupy the same space as the caster, in a clump, in the same square, moving through the caster and each other as necessary.
As a side note a house-rule allowing you to control placement, and possibly movement of the illusions would be really cool.