When you're new to photography, you might feel a bit overwhelmed by all of the various technical parameters and artistic guidelines you have to keep in mind simultaneously. Well, I'm here to add another one to the list, but I promise that it will improve your shots drastically.
When I was first starting out in photography, I spent a lot of time getting the basic of proper exposure down: shutter speed, aperture, and ISO, then learning how to vary those to my liking to get also fulfill whatever artistic vision I fancied at the moment. I then spent a lot of time honing my eye for interesting subjects. I then put it all together. And guess what? I came home with a lot of disappointing shots and a few lucky keepers.
So, what was the problem? I spent so much time focusing on the subject that I didn't pay attention to everything that wasn't the subject. In other words, I ignored the rest of the frame, and in doing so, I allowed distracting elements to make there way in. And "allowed" is almost too generous a word, as it implies I made a conscious decision to leave them there. More accurately, I was so focused on the subject that I was entirely unaware of their presence. This meant that I'd often come home thinking I had some keepers, only to be surprised and disappointed when I opened the set on my computer and discovered the distracting elements I had missed.And really, this sort of problem can happen is almost any genre: perhaps you missed that ugly stick in the foreground while shooting that beautiful field of tulips that you could have avoided by moving a foot to the side. Perhaps you didn't notice that trash can in the background behind the bride and groom that you could have excluded by angling a foot to the left. Perhaps you didn't see the power lines intersecting your subject's head that could have been removed by trying a new location. It's a mistake very few genres are immune from.
Clone Them Out
This isn't the ideal solution, because it doesn't really solve the fundamental issue, it creates more work on the post-processing side of things, and it might not always be possible depending on how big and where the distraction is. Still, we still all make this error every once in a while, or there might be cases where you simply can't get rid of a distraction and know you'll have to take care of it later. Being adept with the clone stamp tool is one of the most fundamental and useful post-processing skills any photographer can have, and it'll serve you well down the road. In the case of the rogue hiker above, he was was small in the frame and was easily taken care of with five seconds of editing.
Shoot at Wide Apertures
There is a good reason photographers love wide aperture lenses. With a narrow depth of field, out-of-focus elements are rendered softly and without definition, turning them into a wash of colors and nebulous geometric shapes. This allows photographers to easily emphasize the subject and de-emphasize everything else. This is great, particularly for photographers who are shooting in quickfire scenarios in which they don't have much control of the location, such as events and wedding photographers.
In order to maximize this sort of subject-background separation, you'll want to shoot at a wide aperture with your subject as close to the camera as possible and as far from the background as possible. This will maximize your background blur. At the same time, there's more to life than f/1.4, as fun as it is, and don't forget that the sweet spot of most portrait lenses is around f/5.6, so you're trading sharpness for a wider aperture when you do this. Nonetheless, it's quite useful, especially when you don't have control of the environment.
Learn to See the Entire Frame
So far, the tips I've provided have been workarounds more than actual solutions to the problem. But if you want to avoid the extra work of cloning out distractions and the restrictions of shooting at wide apertures, you need to train your eye to see not just the subject, but the entire frame. To do this, take a photo walk. As you find subjects, frame them like you normally would. Then, slowly and deliberately examine each corner of the frame: top left, top right, bottom right, bottom left and take careful note of what you find. This will train you to look laterally. When you come across the next subject, focus on it, then try to defocus your eye and take in what's in the background. Next, defocus your eye again and try to take in the foreground. Do this without moving your eye from the subject. This will train you to take in depth. Alternate the lateral and depth exercises with each new subject. As you practice this over the course of a few weeks, you'll find you have to be less deliberate and slow about it and that it'll happen almost automatically, allowing you to do it in stride. As a consequence, your compositions will become more complete, cleaner, and stronger.
A strong subject with a messy composition makes for a weak photo. It's crucial that you be able to evaluate everything contained in the frame simultaneously — not just the subject. By training yourself to quickly take in everything in the frame, you'll find that you can create better photos more confidently.