In a two slit experiment, We are able to see the interference pattern on the screen even if the apparatus shoots one electron at a time, ie.- there is no way that the electrons are interfering with other electrons passing through the other slit. Are the electrons interfering with themselves? Does the electron just pass through both the slits at the same time and then interfere with itself and produce those stripes on the screen? Moreover if we install a detector at the slits, surprisingly the interference pattern vanishes (which explains wave-particle complementarity) but What tells the electron that it is being watched?
One has to think quantum mechanically. In quantum mechanics there are probability distributions given by the square of the complex wavefunction evaluated with the boundary conditions of the specific problem at hand.
The double slit is the scattering problem " electron scattering on two slits of given width and distance between them" . The single electron is a spot on the screen, the footprint of a particle similar to a classical particle, an (x,y,z).
The spot looks random, it is only the probability distribution accumulated over many electrons that displays a wave nature.
Moreover if we install a detector at the slits, surprisingly the interference pattern vanishes (which explains wave-particle complementarity) but What tells the electron that it is being watched?
It is the change in the boundary conditions, which detecting which slit the electron went through necessarily induces, that changes the probability distribution. It is a different experiment.
"What tells the electron that it is being watched?"
Currently, the best way we have to understand what's happening in this type of experiment is to describe the whole system using quantum mechanics, including the electron, the slits, the ambient air, the ambient light, the walls of the laboratory, and so on. Analyzing this in complete detail would be prohibitively difficult, but we can still anticipate some general features of the result.
With that in mind, instead of thinking of the electron as changing its behavior when it's being watched, we can think about how the electron influences its surroundings.
Measurement is a physical process in which the thing being measured influences its surroundings in a practically irreversible way. For example, we can casually measure the location of a rock by collecting light that was scattered by the rock, because rock's effect on the light depends on the rock's location. Once light is scattered, the effect is practically irreversible, because other things (air molecules, people's memories, etc) will then be influenced by the scattered light, and those effects again depend on the rock's location. For a macroscopic object like a rock, this is happening constantly, even if nobody is trying to measure it's location. If we somehow managed to produce a state in which the rock were in a quantum superposition of two different locations, then according to quantum theory, the rock's location would almost immediately become "entangled" with the rest of the system as a result of these location-dependent influences. (This is analyzed quantitatively by Tegmark in "Apparent wave function collapse caused by scattering", https://arxiv.org/abs/gr-qc/9310032.) If any people happen to be around, then the rock's location would become entangled with them, too. Turning this weird-sounding picture into a testable prediction requires applying Born's rule (which involves taking the square of the complex wavefunction, as anna v said in the original answer above). Quantum theory doesn't tell us exactly why or when we should apply that rule, but we can safely apply it after the rock's location has become thoroughly and irreversibly entangled with the rest of the system.
In contrast, something as tiny as an electron can temporarily avoid influencing its surroundings in any way that depends significantly on its location. As long as it's avoiding this, the electron can gradually "spread out" and do things like passing through both slits at the same time. However, as soon as it influences its surroundings in a significantly location-dependent way (such as when it hits the imaging medium downstream from the slits, or such as when some kind of detector is installed to "observe" which slit it goes through), its location becomes entangled with the rest of the system, just like the location of the rock in the preceding paragraph. When this happens, we can apply Born's rule, and the result is what anna v depicted above.