Chemical bonds are what hold things together.
Electrons are attracted to protons. Protons are in the nucleus of the atom, and electrons crowd in as close as they can to the nucleus, attracted by the protons. But electrons repel one another, and only a few can occupy each energy level around the nucleus.
Electrons try to get as close as possible to a nucleus, but are prevented from getting too close if the spots near the nucleus are already filled with other electrons. This means that if we have two atoms, and one has an electron far away from the nucleus, and the other has an empty spot near the nucleus, the electron from the first atom can fall into the empty slot of the second atom.
Sometimes the electrons actually leaves the first atom and joins the second. That leaves two ions. The first is positively charged, since it is missing one of its electrons. The second is negatively charged, since it has an extra electron. These two ions are attracted to one another, because they have opposite charges.
In other cases, the electron doesn’t fully leave the first atom. It falls into the empty slot in the second atom, but it still fills the outer slot in the first atom. The two atoms are held together by the attractions of their nuclei to the shared electron.
In many elements (the metals) the outer electrons are very mobile, since they are far away from the nucleus, and are attracted to all of the nearby nuclei by about the same amount. They move from nucleus to nucleus, always staying far out where the attraction is fairly weak. The effect is that the positive nuclei are surrounded by a sea of negative electrons, flitting around from atom to atom.