I'm not going to lecture about the wide variety of M42 screw-mount lenses. They're all over the place. You can get some amazing lenses, and for very little money.
What I'm going to talk about here is the practicalities of hooking one up to your Pentax *ist DS digital SLR.
First things first: In order to use an M42 lens, you'll need a K-mount to M42 adaptor. Pentax sells these, and I think there are a few other companies making them. I found mine at Jim's Used Cameras in Seattle, Washington. Search ebay and you'll find a dozen hits. Not hard to find.
The adaptor is a ring that snaps into the body's K-mount. Then you screw your fantabulistic M42 lens into the ring and start taking pictures.
Before you take pictures, though, you have to understand a few things. M42 is a widely-used and widely-adapted mount system, so it's not a given that your lens will be all that useful mounted to the camera.
Firstly, many M42 lenses are automatic. Meaning, they let the camera push a little button on the lens to close the aperture. Many lenses are only automatic, and thus they don't have a manual setting, and there will be no way for the camera to close the aperture. You'll be shooting wide open if you use one of these lenses.