Each element has a unique number of protons in its nucleus but the number of electrons orbiting around it can vary to some extent. Atoms differ in how they interact with other atoms and molecules. Some tend to attract electrons, while others tend to give up their electrons. Such tendencies determine what kinds of bonds will form between interacting atoms.
An atom is composed of particles known as neutrons, protons and electrons. Protons and neutrons make up the atom's nucleus, while the electrons orbit around it. Protons are positively charged and neutrons have no charge. Electrons have a negative charge and are a counterbalance to the positive charge of the nucleus. An atom that contains equal numbers of protons and electrons has no net charge, an atom that contains more electrons has a net negative charge, and an atom that contains more protons has a net positive charge.
The electrons of an atom do not orbit around it in a haphazard fashion. Instead, they are distributed around the nucleus in very specific ways. Electrons are assigned to energy levels, with each level forming a sort of shell around the nucleus. Only so many electrons can fit inside each shell and any additional electrons form the next shell. Electrons in the outer energy level are very important. They are involved in bonding and are called valence electrons.
For more information on electrons and energy levels, watch the video below:
The atoms of some elements have a greater tendency to attract electrons, and this property is known as electronegativity. How much an atom attracts electrons is mainly a function of how many protons are in the nucleus and how many other electrons are already orbiting it. Atoms with more protons have a greater amount of positive charge available to attract additional electrons, but larger atoms also have electrons around them in several energy levels and these electrons can shield any additional electrons from the attractive forces of the nucleus.
The periodic table is useful in helping to visualize which elements tend to take electrons from other elements. When you look at the table and move from left to right across each row, the number of protons in each element increases. This means that the element can attract electrons more strongly, or is more electronegative. But as you go down each column, the element acquires more energy levels, and this tends to decrease the positive, attractive pull of the nucleus. Therefore, the elements that typically take electrons are generally found in the right, upper portion of the periodic table and include fluorine, oxygen and nitrogen.