There are two parts to this answer:
Subjectively. There is an interesting phenomenon that happens when a person has a portrait or headshot taken of them. As a photographer, I can take a photo of a CEO and think it's a great photo. I can see that it has great lighting, perfect focus, nice smile, and wonderful symmetry and I can get excited in anticipation of showing to the client know they going to be overwhelmed by its beauty. But then something strange happens. I show it the client and their reaction is flat. Not at all what I expected and instead they pick one that I thought was fine but not the one I thought was great. What happened?
It's literally subjective. Many times a person does not like a photo because they see a small quirk or smirk that they don't like about themselves when they see it. It may evoke a bad memory. Or, the angle may remind them of a parent or a family member that also evokes a negative emotion of some sort. Or, the client may be having a bad day or just be uncomfortable in their role as a photographic subject. If, for whatever reason, the client was is having a negative emotional response to a photo it doesn't matter what the technical merits of a photograph may be because the client won't like it. However, the more positive the client's reaction was during the photoshoot or is during the preview the more they'll perceive it as a good photo. Add to it great technical aspects and you'll have a great photograph--at least one the client thinks is great and will treasure.
Objectively, it boils down to either being a genius or hard work. If a person is writing this then they're probably not a genius and have to go the "hard-work" route. This means years of studying design and art concepts and then years of practicing these techniques and concepts until they become intuitive. But there is another aspect that can't be taught or practiced. This is a great photograph has at it's heart a sense of compassion, sensitivity, and commitment.
It's this last aspect that makes a photograph go from good to great.
A camera can make an image technically better but a great photograph can be taken with any sort of image capturing device.