Sometimes you may see obvious spots on your images that are a dead giveaway that you have a dirty sensor. But, if you tend to shoot with a wider aperture, you may not have noticed it so much. Here's a quick and easy way to check and see if your digital camera sensor is dirty and needs a cleaning.
To check you sensor like image 2, put your camera on AV/aperture priority mode and stop down your aperture as small as it will go. Then, point your camera at a clean, blank, white wall (or sheet of paper) and take an image. If you have any visible spots on your image, that are in the same spots on both test shots, then you probably have a dirty sensor. If your camera has a sensor cleaning function, then run the in-camera cleaning. If not, or if the cleaning does not remove the spots, you may need an at-home cleaning kit, or to have a professional clean it.
Some other instances when you might see spots, but it might not be actual dust: damage to your lens itself, or a damaged sensor itself. The best thing to do would be to check with a repair shop if you're having issues. The KEH Repair Center offers professional sensor cleanings, lens cleanings, preventive maintenance care and much more!
Another thing to keep in mind is that sometimes it is impossible to remove every single speck of dust. So, if it's full of spots like the circled image above, have it cleaned. If there's one tiny, faint spot, it probably isn't worth the cleaning and may not even be able to be removed. This is why preventing the dust in the first place is extra important.