A covalent bond is a form of chemical bonding which is characterized by the sharing of electrons between atoms. Covalent bonds are mainly formed due to the tendency of the elements to attain a completely filled outer shell, that is, attain noble gas configuration and become stable.
Elements forming covalent compounds achieve noble gas configuration by sharing electrons within the atoms, unlike ionic compounds which achieve the noble gas configuration either by gaining or losing electrons from the outermost electron shell. In covalent bonds, when two atoms are in need of extra electrons to fill their outer valence electron shell, they will often share an electron. The most common example that most people are familiar with is water. The oxygen in water forms a covalent bond with the hydrogen, thus filling the hydrogen's outer shell with two electrons (this is because the outer shell of hydrogen has a maximum capacity of two electrons). While an oxygen atom, originally having six outer electrons, now has seven valence electrons, it requires another in order to fill the shell, and so it bonds with another hydrogen to form H2O. Oxygen thus has attained the configuration of the noble gas neon and the hydrogen atoms have obtained the configuration of the noble gas helium.
Covalent bonding does not produce electrons, it simply pairs them so that each atom has access to at least one more valence electron than before the bond.
Covalent bonding occurs between atoms with similar electronegativity, and thus most often occurs between non-metals. However, as there are sometimes uneven distributions of electronegativity, either one of the elements in any given compound may attract the shared electrons closer to it than the other one. Therefore, it will have more of a negative charge than the other (while the other becomes more positive). Though this is not a charge to the extent of ions when they gain/lose electrons, due to the slight charge, covalent compounds can produce ionic properties.
A simple way to understand the concept of a covalent bond is, Co can be taken as "co-operation" or "jointly" and valence, so covalent means the co-operation or joining of valence electrons.
Types of Covalent Bonds 
The bonds formed by sharing of an electron pair between two atoms can typically be single, double or triple; that is, in covalent bonds, atoms may be linked together by single, double or triple bonds. In simplest terms, "single", "double", and "triple" refer to the number of shared electron pairs in the bond. For example, in the dioxygen (O2) molecule, each oxygen must share two of its electrons in order to obtain the noble gas configuration of 8 valence electrons, resulting in a double bond of two shared electron pairs. The valency of an atom is the maximum number of bonds it can form, usually the number of electrons required to reach a stable noble gas configuration (there are exceptions to this rule, called the octet rule as all noble gases except helium have 8 valence electrons, discussed further down). Each double bond counts as 2 bonds for this purpose, and each triple bond counts as 3.
Whether a bond is single, double, or triple is its bond order.
Single Covalent Bond 
In some molecules, a shared pair of electrons are contributed between the atoms, thus creating a "single bond". For example, in a hydrogen molecule, the two atoms of hydrogen are bonded together by a single bond.
How? The valency of hydrogen is 1, that is, the number of electrons present in the outermost shell is 1 and it needs 1 more electron to attain a noble gas configuration, that is a completely filled outer shell.
H has a valency of 1 and it needs 1 more electron to become stable. So, it forms a bond with another hydrogen atom and shares its electron with it and the second hydrogen atom shares its 1 electron with the first one,
(Here, x shows the number of electrons present in the outer shell of a hydrogen atom.) Now, the first atom shares its one electron with the second hydrogen atom and the second atom shares its one electron with the first one and thus we get one hydrogen atom.
Thus, 2 atoms of hydrogen share their electron to form a molecule of hydrogen, H2. This allows each hydrogen atom to attain the electronic configuration of the noble gas helium. The shared pair of electrons is said to constitute a single bond within the two hydrogen atoms. It is a single bond because only one pair of electrons are shared within the hydrogen atoms. A single bond is denoted by a single line between the atoms. For example, the covalent bond in a hydrogen molecule is represented by:-
Such single covalent bond is also formed in chlorine molecule, Cl2.
Double covalent bonds 
Sometimes, two atoms share two, not just one, electron pairs to attain a noble gas configuration, with each atom contributing two electrons for a total of four bonding electrons. The minimum valency of an atom that can participate in this kind of covalent bonding must have a minimum valence of 2. O has a valency of 2, with 6 electrons, needing 2 more to become stable (although oxygen has 6 electrons, it has a valency of 2 because it only needs 2 more for stability). It therefore can form a double bond with another oxygen atom, with each atom keeping 4 of its electrons uninvolved in bonding and sharing 2 with the other atom.
4 kept electrons plus 4 shared electrons then equals a stable 8-electron configuration. A double bond is denoted by a doubled line between the bonding atoms:
Such a double bond is also found in the carbon dioxide molecule CO2:
Here, each oxygen atom double-bonds to the carbon atom. The carbon atom has 4 valence electrons, and since it needs 4 more, it has a valency of 4, allowing it to form 2 double bonds (or 4 total bonds):
Triple covalent bonds 
Likewise, when two atoms share three electron pairs, the bonding interaction is a triple bond. The minimum valency of an atom that can participate in this kind of bonding must be a minimum of 3.
N has a valency of 3, with 5 electrons, needing 3 more to become stable. It can form a triple bond with another nitrogen atom, with each atom sharing a total of 6 electrons with 2 unshared, making a full octet.
bonds to form:
A triple bond is denoted by three lines connecting the bonding atoms:
Exceptions to the octet rule 
Often one or more bonding atoms in a molecule do not satisfy the octet rule, even though the atom is stable with respect to its electron configuration.
For example, sulfur (S) has 6 valence electrons like oxygen. One might expect it to always share two to gain a noble gas configuration, but in sulfur hexafluoride (SF6), it shares all six of its valence electrons in single bonds with fluorine, thus exceeding the octet rule by 4 electrons:
Likewise, sometimes an atom might have less than a full octet. Most elements that are not in the main groups (IA, IIA, IIIA-VIIA) don't follow the octet rule in this manner, and group IIIA elements also tend to have less than an octet.
Boron (B) has 3 valence electrons, needing either 5 more or 3 less to achieve a noble gas configuration. However, gaining 5 is not very easy (although it is possible, discussed later) while boron is too electronegative to fully lose all three.
Therefore, boron has a valency of 3 and shares all three valence electrons. However, other atoms can only share 3 total additional electrons with boron for a total of 6 - 2 short of the octet rule. Boron compounds of this kind are nevertheless stable. One example is boron trichloride (BCl3):
The third and least-common violation of the octet rule occurs for molecules where the total valence electron count is an odd number. This makes complete electron pairing impossible and it is not possible to achieve a full octet For example, nitrogen monoxide (NO) has a total of 11 valence electrons. Nitrogen and oxygen easily share two electrons each, but nitrogen still needs a third electron. Oxygen and nitrogen can then be said to be sharing a third electron contributed from oxygen that is unpaired. However, this is not a replacement for a full electron pair and this is not a triple bond. It is more than a double bond, though, and can be called a "2 and a half" bond, where the dashed line represents the "half-bond" (this terminology is not exactly correct but sufficient for this example):
As might be expected from the presence of an unpaired electron, odd-number-electron molecules tend to be reactive, as they are made more stable if their unpaired electron is paired.
Dative covalent bonds 
The bonding pair of electrons need not come from both atoms. In some cases a single atom supplies both electrons shared in a bond. In carbon monoxide (CO), oxygen has 6 valence electrons and carbon 4 valence electrons. If each atom shares two electrons each, then oxygen satisfies the octet rule but carbon is still in need of two.
Oxygen thus will share two more of its electrons with carbon, forming an additional bond with the pair of electrons entirely contributed from oxygen. This bond is a dative covalent bond. The electrons in question are highlighted in green.
This additional bond adds on to the two bonds already made, so this is a triple bond, albeit an unusual one where the atoms don't make equal contributions to the bonding. It is represented like any other triple bond:
Dative covalent bonds can also allow boron to achieve a complete octet. Boron trifluoride, with the same structure as boron trichloride (mentioned above), can react with ammonia (NH3), where nitrogen has 2 unshared electrons. The boron atom can link up to nitrogen in a dative covalent bond using those electrons: