Learn all the rules, then realize sometimes the best photos are when you break them.
Sometimes the best photos are the ones that are done with technical perfection.
Sometimes the best photos are the ones that have the best expression.
Sometimes the best photos are pure and absolute luck.
All the times, it depends on the person looking at them.
It's hard. There is no pure answer to this question. Knowing all the technical things and following some rules will give you a generally higher rate of success than not, but there are layers upon layers of more subtle and subjective things that can take a good photo and make it great or horrible, depending on how it all works out.
My very best picture was taken at an "OH CRAP I'M GONNA DIE AS I FALL OUT OF THIS HELICOPTER... oh wow, look at that bridge! >click<" moment. Everyone loves it. I've sold numerous copies of it.
It actually has a variety of technical failings that no one seems to care about. My wife thinks it sucks, and she knows nothing of photography.
