If you can see dust or hair through your viewfinder, it's most likely on your mirror or lodged in the prism in the viewfinder. You'll never see any effect on images because the mirror swings up and out of the way for the sensor or film to record your picture. Hence the name Single Lens Reflex (light is reflected from the mirror into the prism to your eye when composing). So unless it's a distraction or severe, you can forget about any gunk on either. But minimising dust on your mirror can help keep your sensor clean.
To clean your mirror, get some sensor swabs like those above, a blower or canned air and some rubbing alcohol (all available at photo stores). Turn your camera off. Remove your lens or body cap and inside you'll see the mirror sitting transversely and tilted on a 45-degree angle upwards. Invert your camera and blow any dust off the mirror with the blower while it's upside down so dust falls away from the camera's insides. This might be all you need to do but if any stubborn spots remain, you will need to wipe with a swab. Dilute the alcohol 70/30 with water and moisten the swab. Press the swab on to tissue paper to remove any excess alcohol, it should be just damp. Start from one end of the mirror and with very gentle pressure, wipe it lengthways along the mirror. Turn the swab and repeat the other way back to where you started. Repeat with a fresh and completely dry swab to remove any excess cleaner. I wouldn't attempt trying to take apart a viewfinder to clean the inside unless it's an old film camera that I know won't have any electronics I risk messing with.
Do all of this in a clean draft-free environment, there's a lot of static inside a camera that's a magnet for dust.
There's plenty of people who clean their sensors manually. I don't. If your DSLR's own sensor cleaner (you'll find this in your camera's menu) doesn't remove any marks that you can see on your images, send it in for a professional clean.
If you want to keep dust off your sensor, the simplest and most effective way is to keep the the rear element of your lens clean and the inside of the end cap free of dust that might get electrostatically attracted to the sensor. Sensors are charged and static attracts dust so always turn your camera off when changing lenses. And don't forget your lens and camera mounts - dilute rubbing alcohol 70/30 with water, moisten a cotton bud, soak off the excess with tissue so no liquid is penetrating the lens or contacts, and clean both mounts thoroughly.