the only way to predict the products in a reaction is to work from what you know, but just looking at a couple of chemical formulas, you can't honestly predict the reactants, a priori. You have to already know something about the reaction, or a reaction that is similar to it.
Say, when learning organic chemistry, you are usually taught about classes of reactions and what they do, and then they give you a test that asks you to predict the products based on what you learned in class. But if you were to be given the chemical formulas for some reactants and be asked to predict the outcome of the reaction with no prior knowledge then that would be very difficult.
Nowadays, though, there are computational methods that can simulate all the wavefunctions, etc. involved and calculate the relative energies of certain molecular configurations and whatnot, and that can be a way to predict the product of a reaction, but doing that on anything but very simple systems becomes quite a task.
Then after all that, it's usually an approximation so you still can't be 100% sure.