There are three parts to this answer. The first part is understanding the technical aspect of light and how it plays on film or a digitized image. The best photograph in the world is meaningless if it's blurred or otherwise flawed.
The second part to this is much more difficult. It's called composition or how various elements in the photograph are arranged within a defined block of space. The truly great photographers composed their photos in a different way.
The third part is subject and treatment of that subject.
Putting all these elements together in a cohesive piece makes it a work of art. For example, the perfect photograph is one that needs no caption. You know exactly what it is because the photo contains everything. Very few of these exist even though hundreds of millions of photographs have been taken.
For example, there's the classic photograph of a starving baby lying in dirt and being stalked by a vulture. The photo, taken by South African photographer Kevin Carter, won the Pulitzer Prize in 1994. There's nothing missing in that photo. No caption is necessary.