I started to learn Chemistry with something like Hydrogen having 1 electron in the first shell, Oxygen having 2 electron in the first shell and 6 electron in the second shell... But I don't really understand how scientists know it? How do they know there are how many shells and how many electron per shell? Is that something visible? Or just an imagination theory or they using a method to measure?
Electrons are not actually separated in shells. That is a simplified model to explain the atom's structure when people first start approaching Chemistry or Physics.
In reality, electrons' movements around the nucleus are governed by complex equations (some of them not even resolvable so approximations are needed) to form what is called an electron cloud. This cloud is confined in proximity of the nucleus by the electromagnetic force. Every electron is defined by its wave equation, which tells us the probability that the electron appears to be at a particular location when its position is measured. These equations allows us to define regions in space where the electron spend the most part of its time around the nucleus, and they can be visualised as atomic orbitals, as shown below. Orbitals can have one or more ring or node structures, and they differ from each other in size, shape and orientation.
Each orbital (which is defined by a different equation) has different associated parameters, called quantum numbers, and a particular energy. These properties allow us to divide them into levels and sublevels, to form a structure that resembles multiple shells one inside each other. But as you can see from what I explained the structure is in fact far more complex.
This knowledge has been gained over time both from the mathematical and physical analysis of different equations (like Schröndiger equation) and by experimental data collected by the means of different techniques. Starting from Thomson and Rutherford the model of the atomic structure has seen many changes (Bohr, Moseley, Van der Broek, de Broglie, etc.) and it has come closer to a realistic representation of the actual atom. Take a look at their experiments to understand how it has been studied. However, they often involve particle physics and are not really straightforward to understand.
One way to think of this is to think of the total number of bonds that atoms can make. You can then use experimentation to look at the structure of the compounds, and that will tell you a lot about how the electrons are configured around the nucleus. For instance, Carbon compounds tend to take on tetrahedral shape if the bonds are saturated (single covalent), this means that carbon bonds most favourably by forming 4 bonds. If the moieties that are bound are all the same such as hydrogen, the angle of the bonds should be the same, and using x-ray crystallography for instance shows us that this is the case. We understand chemical bonding quite well, and we can deduce that each hydrogen, donates its single valence electron to a single valence electron from the carbon to form a covalent bond, the total number of valence electrons for carbon must therefore be 4. This is because the 2p shell is higher energy than the 2s shell and only the 2p electrons are free to bond. (This isn't really the case, the bonds are hybrid sp bonds but I won't get in to that right now)