The electrons surrounding the atomic nucleus are not just randomly located. For reasons we may pursue later, they have preferred location called shells. Atoms have a strong desire to have their outer shell filled with a full complement of electrons. So much so in fact that they are not above sharing the electrons of a neighboring atom. That way the outer shell of each atom is filled at least part of the time. This sharing of electrons causes the atoms to stick together in what is called a covalent bond. These bonds can get pretty extensive, involving several atoms. The resulting clump of atoms is called a molecule.
When a bunch of atoms are bonded together to form a molecule, the molecule will itself not have a random electric charge distribution. There will be regions with relatively many electrons and regions with relatively fewer, so electrical forces will also tend to hold molecules together. In the case of our baseball bat, the molecular structure was established by the chemical reactions going on in the growing wood from which the bat was cut. In the absence of some pretty serious forces, these atomic and molecular bonds are going to hold the bat together.