If your subject is moving the shutter speed use will also determine how sharply its rendered. In this image of a horse race I deliberately used a long shutter speed to create an abstract blur.
Shutter speed
The shutter speed you use is a big factor in how sharp an image is. This is particularly true if you're handholding your camera. Humans aren't perfectly steady. Even when standing still the simple act of breathing causes movement. If you use too low a shutter speed then this unsteadiness will cause camera shake. Where the shutter speed/camera shake threshold lies depends on you and the focal length of the lens fitted to your camera (and whether your camera or lens has image stabilisation). The longer the focal length of the lens the greater the risk of camera shake. A reasonable rule to follow is to match the shutter speed to the focal length of the lens. If you're using a 500mm lens say you'll need to use at least 1/500 as a shutter speed.
At maximum aperture depth of field is at its minimum. Careful focusing is therefore require to ensure that the most important part of the image is sharp.
Even when a camera is fitted to a tripod you still have to be aware of camera shake. If your tripod is on soft ground (such as sand) it can sink during an exposure. If you move around during an exposure this can cause the tripod to move too. This can be a problem when shooting star trails on clear, frosty evenings. The temptation to move around to keep warm often proves far too tempting but should be resisted as far as humanly possible. While we're on the subject of tripods setting them up correctly is important too. Splay the legs out to their furthest extent and try to avoid using the centre column if possible. Both of these tips will keep your tripod more stable than it otherwise would be.
See close-to it's easy to say which is a higher resolution image. Now view both from 10 feet away. It's not so easy now is it?
Lenses
There are two factors to be aware of with lenses when it comes to sharpness. First, lenses are at their optical peak in the mid-range of apertures. Use a lens wide open (that is, using maximum aperture) and the results can be pretty gruesome. Typically the centre of the lens is better than the corners at maximum aperture. Corners tend to be softer than the centre and don't get close to catching up in terms of sharpness until you've stopped down to f/8 or f/11.
The other factor is depth of field created by the aperture. At maximum aperture depth of field is at its minimum. This means that you have focus more accurately in order to ensure than your subject is sharp. The temptation is therefore to use the smallest aperture possible to maximise depth of field. In theory this is fine. However, a phenomenon called diffraction rears its ugly head when small apertures are used. Diffraction reduces resolution making an image look softer. Again, using a mid-range aperture is often the best compromise to maximise image quality.
This image suffers from camera shake, clearly visible at 100%. Shrink the image however and it looks much sharper. The size an image is reproduced is also a factor in how sharp in looks.
Viewing distance
You've shot an image and are viewing it at 100% on your monitor. It looks disappointingly soft and the temptation is to bin the image. Resist that temptation! I'm use a 24mp camera. At 100% magnification I can view about a quarter of the whole image on my monitor. If I were to make a print four times the size of my monitor the print would be 30 x 20 inches. There's no way I'd view a print that size from the same distance as my monitor. I'd step back. In stepping back the print would look sharper.
Images look sharper the further away from them you are. Don't believe me? Take a look at the image below. It doesn't look very sharp does it? Now view it from ten feet away. It looks sharper doesn't it? Viewing distance is a strangely neglected factor in how sharp an image is perceived to be.