They have more sophisticated methods today, but accidents and serendipity still play a role in the discovery of new chemicals. There are many theories of chemical bonding and rules of synthesis. Many things are now known about how certain chemicals and chemicaly reactive groups will interact with each other. Chemists can now also use complex mathematical models of chemical bonding and simulate these interactions on computers to anticipate how things will react, or how certain compounds will associate with others in solution, or at reactive sites.
making a small donation to science.ca.