Aperture and Depth of Field
In conventional and digital photography, the aperture measures the amount of light that is allowed in. When the iris is opened up, more light is allowed in and this measures a lower f-stop reading. The aperture reading does more than just determine how much light is allowed into the camera, it is also part of the equation in what determines the depth of field. When the iris is opened up the depth of field, which is the area in front of the camera that will be in focus, shrinks. What is important in your digital photo image is to use the aperture settings to get the right exposure and depth of field for your intended image. The middle aperture point tends to be one of the sharpest available, this is why the suggestion is often f/8 for sharpest aperture.
The main reason that you would select f/8 for sharpest aperture is that it allows you to focus less on the sharpness of the objects. This middle position is going to give you a generally middle ground image that, while it may not be specific to certain photographic situations and choices, is going to give you much more security. This often makes the f/8 aperture setting one of the best for photojournalists trying to get clear images on the fly. In general, you can assume that for most lenses you are using you are going to find the sharpest from f/5.8 to f/8 or f/8 to f/11.
When to Choose F/8 for Sharpest Aperture
There are going to be specific instances when you will absolutely want to choose f/8 for sharpest aperture. If you are taking images of objects or surfaces that are relatively flat then f/8 is going to give you the appropriate depth of field. In general, you will also find that better prime lenses will also be best when set at f/8, though you are going to find that f/11 is going to be more appropriate for the more simple options.
F/8 is also going to stand out as the point when the falloff of light, which is where the light dissipates off of a subject, begins to be difficult to see. This is part of why this is a perfect negotiating point between the higher f-stops in what it will allow in terms of light. This should end up as part of your negotiating with your lighting, but your depth of field is going to be more important than ensuring a certain exposure. What you can do instead is change and intensify the lighting in the physical location to compensate as long as you want to maintain the f/8 aperture setting. This will likely change the character of the light in a certain sense, possibly even intensifying the contrast in your image, but it may be what you need if you want to maintain the consistent sharpness of the f/8 aperture.