Here and there I read of people who set their lens to a small aperture while testing their sensor cleanness, supposedly to get the best image of dust speckles. However, the image of the on-sensor dust particles should not, to my understanding, be affected by the sharpness induced by the lens settings. Same is true for dust particle on the lens elements themselves. It makes me wonder - do these people misunderstand the theory of how the optical system work, or am I missing something?
If the dust was really on the sensor proper, you'd be absolutely correct.
At least in the normal case, it's virtually impossible for dust to get on the surface of the sensor itself, because there's a couple millimeters or so of filters directly in front of the sensor. The front-most of these is (at least in the usual case) the AA filer.
The important thing is that all of this transparent glass. Therefore, with a wider aperture, there's more light coming at the sensor from various angles. Since the light can travel at whatever angle through those filters (because they're all at least mostly-transparent glass), the dust spots won't normally block all the light. With a smaller aperture, the light comes nearly straight back from the small aperture, so the edges of any dust spots are clearly defined.
In practice, the difference is pretty obvious. Here's a shot at f/1.7, then shot taken a few moments later at f/22 (same camera, same lens, etc. -- all that's changed is the aperture and shutter speed):
Like usual for this situation, I've also boosted the contrast to make the dust more visible -- since it's a plain, low-contrast subject, the histogram starts out like this:
To make the dust more apparent, you adjust the levels something like this:
If you apply it to the f/1.7 picture (as I did above, to keep things fair), that will also overemphasize the light falloff at the corners of the picture. Though there is some anyway, it's not normally even close to as bad as it looks in the first shot above.
Note that this is a pretty rigorous test. This sensor is clean enough that on typical shots, there's no sign of dust on the sensor at all. Between the total lack of contrast/detail in the subject, tiny aperture, and extreme boost of contrast, we're seeing quite a bit that we'd never see in any normal picture (not to mention that the two worst spots here are near the bottom of the frame, where there's nearly always at least a little detail to hide these problems anyway). If you test this on your own camera, don't be too surprised if it looks (quite possibly a lot) worse than the ones above. From what I've seen, I'd guess that most dSLRs (and a pretty fair number of P&S cameras too) are at least a little, and often a lot, worse than this.
If I understand your question correctly, stopping the aperture down to its narrowest ensures that light is focused as tightly as possible. If you take a photograph at a wider aperture, excess non-incident light will still make it to the sensor, and mitigate the effects of sensor dust.
To put that in more precise technical terms...with a narrow aperture, the light that strikes the sensor is from as narrow a field as possible, and as close to perpendicular as possible (90° to sensor plane). That causes dust particles to create a "sharp shadow" on the sensor. At a wider aperture, the light that strikes the sensor is from a wide field of view, and light may not always be perpendicular (could be anywhere from 90° to say 70°), since the entire lens surface plays a role in
focusing light. Those off-axis rays of light cause dust particles to create a "soft shadow" on the sensor.
You could demonstrate the effect at a macro scale, if you need a visual exemplar. Hold your hand up a foot or two from your wall, and point a bright but narrow beam of light at it...say from a flashlight about 10 feet away. The shadow from your hand should be clear and sharp. Perform the same experiment again, however this time, set up several shaded lamps that emit light in a broad field in a line parallel to the wall about 10 feet away. The shadow from your hand should be soft and dim, if visible at all (except under closer scrutiny.) Narrowing your aperture is akin to using the flashlight, while widening it is akin to setting up a wider row of lights.