The effect you are describing in your question is known as wave-particle duality and is a form of complementarity, it has been observed in various experiments. Realisations of Wheelers delayed choice thought experiment are what I find most interesting.
In a delayed choice experiment the particles are not measured before they go through the slits but labeled so which slit they go through is known. The only time a quantum system is not disturbed by a measurement is when no new information is gained from the measurement, labeling ensures which slit the particle went through can be known without disturbing the quantum interference$^1$ of the wavefunction. In this context the purpose of any measurement would be to tell which slit a particle went through anyway.
If a particle has a label when it is detected (at the screen) there is no interference and particle-like behavior is observed. If there are no labels there is interference or wave-like behavior, even if the labels are erased after the particles pass through the slits and it cannot be known which slit they passed through.
It appears that it is not possible to see interference and know which way the particles have gone simultaneously. If there is some which way information that enables a better than blind guess at which slit the particles went through the visibility of the interference is reduced.
However, observation of wave-particle duality does not really require wavefunction collapse. Has wavefunction collapse been observed? In my opinion no, but the publicists for this Nature paper disagree. Collapse is connected to interpretations of quantum mechanics.
Collapse of the wave function would imply that the wave function is real (ontic) as opposed to only representing what we know about a quantum system (epistemic). This is an open question, some physicists think one some the other. There is no experimental evidence either way yet, until there is some physicists might say "Collapse? Ontic? Epistemic? that's all about interpretation, shut up and calculate"
If the wavefunction is purely epistemic then there is nothing real to collapse, only the state of knowledge. If it's ontic then wave function collapse would be a possibility, but even then wavefunction collapse is not required to explain quantum measurement.
$^1$Interference is like the pattern on the left in your question, the wave-like behavior.
The other answers here, while technically correct, might not be presented at a level appropriate to your apparent background.
When the electron interacts with any other system in such a way that the other system's behavior depends on the electron's (e.g., it records one thing if the electron went left and another if it went right), then the electron no longer has a wave function of its own: the electron+"detector" system has a joint state. The two are entangled.
The electron doesn't have to "know" anything. The simple physical interaction results in a state vector which, by the laws of quantum mechanics, will preclude interference by any of the subsystems of this larger system. That said, the joint state can itself show a kind of "interference effect" (though not the kind you normally think of in the two-slit experiment).
If this entanglement is well-controlled (as in a lab), then (a) showing this "joint interference" might be practical, and (b) undoing the entanglement is also possible, thus restoring the electron's sole superposition. This is how we know that it hasn't "collapsed."
But if the entanglement is caused by stray photons, air molecules, etc., then any hope of controlling them becomes almost immediately dashed, and we can no longer exhibit interference in practice. From here on out, the system will appear to behave classically, with the different branches evolving independently. This fact is called decoherence. The superposition still hasn't "collapsed," but we no longer have the ability to show or exploit the superposition.
You may notice that this still leaves open a crucial question: when do the many branches become one? This is called the measurement problem, and physicists don't agree on the answer even today.
Best Answer
I think this question arises from a simple misunderstanding of what a wave function is. The wave function of a particle doesn't need to be "wavy". The description of a system in quantum mechanics is always given via its state-vector in the Hilbert space and that can always be translated to the wave function of the said system in a basis of your choice, e.g., the position basis or the momentum basis.
A wave function $\psi(x)$ of a particle in position basis simply gives you the probability amplitude of the particle at position $x$ which is a complex number, i.e., it gives you two bits of information:
So, the point is that there is always a wave function of a particle -- regardless of whether it is very localized and point-like or not.
As to why wave functions are nonetheless called wave functions, I think it's a historic relic. There are two tangible historic reasons that resulted in this naming, I think: