Atomic and molecular bonds

Why different atoms stick with each other to form molecules? What cause the different arrangements of molecules which create different properties?