You know if it's going to be good just like you know ahead of time when you cook something. How do you know that a tried-and-true cake recipe will be good at the end? Well, it's because you tried it before, and it tastes good.

Now, how do I know that a photograph will be well-exposed? Because I meter the light to know how bright it is. Then I set the shutter, which is a precise clockwork mechanism, to let in just the right amount of light. The film has been made to unbelievably exact specifications to react "just so" to the light.

How do I know I got just the right composition? That's a different question.