Fundamental forces behind covalent bonding
I understand that covalent bonding is an equilibrium state between attractive and repulsive forces, but which one of fundamental forces actually causes atoms to attract each other?


The role of Pauli Exclusion in bonding

It is an unfortunate accident of history that because chemistry has a very convenient and predictive set of approximations for understanding bonding, some of the details of why those bonds exist can become a bit hard to discern. It's not that they aren't there -- they most emphatically are! -- but you often have to dig a bit deeper to find them. They are found in physics, in particular in the concept of Pauli exclusion.

Chemistry as avoiding black holes

Let's take your attraction question first. What causes that? Well, in one sense that question is easy: it's electrostatic attraction, the interplay of pulls between positively charged nuclei and negatively charged electrons.

But even in saying that, something is wrong. Here's the question that points that out: If nothing else was involved except electrostatic attraction, what would be the most stable configuration of two or more atoms with a mix of positive and negative charges?

The answer to that is a bit surprising. If the charges are balanced, the only stable, non-decaying answer for conventional (classical) particles is always the same: "a very, very small black hole." Of course you could modify that a bit by assuming that the strong force is for some reason stable, in which case the answer becomes "a bigger atomic nucleus," one with no electrons around it.

Or maybe atoms as Get Fuzzy?

At this point some of you reading this should be thinking loudly "Now wait a minute! Electrons don't behave like point particles in atoms, because quantum uncertainty makes them 'fuzz out' as they get close to the nucleus." And that is exactly correct -- I'm fond of quoting that point myself in other contexts!

However, the issue here is a bit different, since even "fuzzed out" electrons provide a poor barrier for keeping other electrons away by electrostatic repulsion alone, precisely because their charge is so diffuse. The case of electrons that lack Pauli exclusion is nicely captured by Richard Feynman in his Lectures on Physics, in Volume III, Chapter 4, page 4-13, Figure 4-11 at the top of the page. The outcome Feynman describes is pretty boring, since atoms would remain simple, smoothly spherical, and about the same size as more and more protons and electrons get added in.

While Feynman does not get into atoms how such atoms would interact, there's a problem there too. Because the electron charges would be so diffuse in comparison to the nuclei, the atoms would pose no real barrier to each other until the nuclei themselves begin to repel each other. The result would be a very dense material that would have more in common with [neutronium[(http://en.wikipedia.org/wiki/Neutronium) than with conventional matter.

For now I'll just forge ahead with a more classical description, and capture the idea of the electron cloud simply by asserting that each electron is selfish and likes to capture as much "address space" (see below) as possible.

Charge-only is boring!

So, while you can finagle with funny configurations of charges that might prevent the inevitable for a while by pitting positive against positive and negative against negative, positively charged nuclei and negatively charged electrons with nothing much else in play will always wind up in the same bad spot: either as very puny black holes, or as tiny boring atoms that lack anything resembling chemistry.

A universe full of nothing but various sizes of black holes or simple homogenous neutronium is not very interesting!

Preventing the collapse

So, to understand atomic electrostatic attraction properly, you must start with the inverse issue: What in the world is keeping these things from simply collapsing down to zero size -- that is, where is the repulsion coming from?

And that is your next question:


  Also, am I right to think that "repulsion occurs when atoms are too close together" comes from electrostatic interaction?


No; that is simply wrong. In the absence of "something else," the charges will wiggle about and radiate until any temporary barrier posed by identical charges simply becomes irrelevant... meaning that once again you will wind up with those puny black holes.

What keeps atoms, bonds, and molecules stable is always something else entirely, a "force" that is not traditionally thought of as being a force at all, even thought it is unbelievably powerful and can prevent even two nearby opposite electrical charges from merging. The electrostatic force is enormously powerful at the tiny separation distances within atoms, so anything that can stop charged particles from merging is impressive!

The "repulsive force that is not a force" is the Pauli exclusion I mentioned earlier. A simple way to think of Pauli exclusion is that identical material particles (electrons, protons, and neutrons in particular) all insist on having completely unique "addresses" to tell them apart from other particles of the same type. For an electron this address includes: where the electron is located in space, how fast and in what direction it is moving (momentum), and one last item called spin, which can only have on of two values that are usually called "up" or "down."

You can force such material particles (called fermions) into nearby addresses, but with the exception of that up-down spin part of the address, doing so always increases the energy of at least one of the electrons. That required increase in energy is a nutshell is why material objects push back when you try to squeeze them. Squeezing them requires minutely reducing the available space of many of the electrons in the object, and those electrons respond by capturing the energy of the squeeze and using it to push right back at you.

Now, take that thought and bring it back to the question about where repulsion comes from when to atoms bond at a certain distance, but no closer. They are the same mechanism!

That is, two atoms can "touch" (move so close, but no closer) only because they both have a lot of electrons that require separate space, velocity, and spin addresses. Push them together and they start hissing like cats from two households who have suddenly been forced to share the same house. (If you own multiple cats, you'll know exactly what I mean by that.)

So, what happens is that the overall set of plus-and-minus forces of the two atoms is trying really hard to crush all of the charges down into a single very tiny black hole -- not into some stable state! It is only the hissing and spitting of the overcrowded and very unhappy electrons that keeps this event from happening.

Orbitals as juggling acts

But just how does that work?

It's sort of a juggling act, frankly. Electrons are allowed to "sort of" occupy many different spots, speeds, and spins (mnemonic $s^3$, and no, that is not standard, I'm just using it for convenience in this answer only) at the same time, due to quantum uncertainty. However, it's not necessary to get into that here beyond recognizing that every electron tries to occupy as much of its local $s^3$ address space as possible.

Juggling between spots and speeds requires energy. So, since only so much energy is available, this is the part of the juggling act that gives atoms size and shapes. When all the jockeying around wraps up, the lowest energy situations keep the electrons stationed in various ways around the nucleus, not quite touching each other. We call those special solutions to the crowding problem orbitals, and they are very convenient for understanding and estimating how atoms and molecules will combine.

Orbitals as specialized solutions

However, it's still a good idea to keep in mind that orbitals are not exactly fundamental concepts, but rather outcomes of the much deeper interplay of Pauli exclusion with the unique masses, charges,  and configurations of nuclei and electrons. So, if you toss in some weird electron-like particle such as a muon or positron, standard orbital models have to be modified significantly and applied only with great care. Standard orbitals can also get pretty weird just from having unusual geometries of fully conventional atomic nuclei, with the unusual dual hydrogen bonding found in boron hydrides such as diborane probably being the best example. Such bonding is odd if viewed in terms of conventional hydrogen bonds, but less so if viewed simply as the best possible "electron juggle" for these compact cases.

"Jake! The bond!"

Now on to the part that I find delightful, something that underlies the whole concept of chemical bonding.

Recall that it takes energy to squeeze electrons together in terms of the main two parts of their "addresses," the spots (locations) and speeds (momenta)? I also mentioned that spin is different in this way: the only energy cost for adding two electrons with different spin addresses is that of conventional electrostatic repulsion. That is, there is no "forcing them closer" Pauli exclusion cost like you get for locations and velocities.

Now you might think "but electrostatic repulsion is huge!", and you would be exactly correct. However, compared to the Pauli exclusion "non-force force" cost, the energy cost of this electrostatic repulsion is actually quite small -- so small that it can usually be ignored for small atoms. So when I say that Pauli exclusion is powerful, I mean it, since it even makes the enormous repulsion of two electrons stuck inside the same tiny sector of a single atom look so insignificant that you can usually ignore its impact!

But that's secondary, because the real point is this: When two atoms approach each other closely, the electrons start fighting fierce energy-escalation battles that keep both atoms from collapsing all the way down into a black hole. But there is one exception to that energetic infighting: spin! For spin and spin alone, it become possible to get significantly closer to that final point-like collapse that all the charges want to do.

Spin thus becomes a major "hole" -- the only such major hole -- in the ferocious armor of repulsion produced by Pauli exclusion. If you interpret atomic repulsion due to Pauli exclusion as the norm, then spin-pairing two electrons becomes another example of a "force that is not a force," or a pseudo force. In this case, however, the result is a net attraction. That is, spin-pairing allows two atoms (or an atom and an electron) to approach each other more closely that Pauli exclusion would otherwise permit. The result is a significant release of electrostatic attraction energy. That release of energy in turn creates a stable bond, since it cannot be broken unless that same energy is returned.

Sharing (and stealing) is cheaper

So, if two atoms (e.g. two hydrogen atoms) each have an outer orbital that contains only one electron, those two electrons can sort of look each other over and say, "you know, if you spin downwards and I spin upwards, we could both share this space for almost no energy cost at all!" And so they do, with a net release of energy, producing a covalent bond if the resulting spin-pair cancels out positive nuclear charges equally on both atoms.

However, in some cases the "attractive force" of spin-pairing is so overwhelming greater for one of the two atoms that it can pretty much fully overcome (!) the powerful electrostatic attraction of the other atom for its own electron. When that happens, the electron is simply ripped away from the other atom. We call that an ionic bond, and we act as it if it's no big deal. But it is truly an amazing thing, one that is possible only because the pseudo force of spin-pairing.

Bottom line: Pseudo forces are important!

My apologies for having given such a long answer, but you happened to ask a question that cannot be answered correctly without adding in some version of Pauli "repulsion" and spin-pair "attraction." For that matter, the size of an atom, the shape of its orbitals, and its ability to form bonds similarly all depend on pseudo forces.