How does the speed of light being measured by an observer, who is in motion, remain constant? I am trying to understand the idea that the speed of light is constant for each observer regardless of their motion. But I don't understand how come. I also don't understand how this was measured.
Let's say there is a distance from point A to point B and the way to measure it would be to use a stopwatch (at point A) that snapshots the time when the laser beam was shot and another stop watch (at point B) where it was received. That I understand.
Now, let's say point B is dynamic and it is moving away from point A. Of course it would take a little more time to reach that point B; because during that period of time when the laser was shot and the time when it reached point B, point B moved a little bit already, which means it would take extra time for the laser beam to cover that gap. This experiment still would show that the speed of light is the same.
Let's say that the moving point B is a train wagon and the point B is actually it's front side. Let's say there is another point, point C which is the wagon's back side. The laser beam that would hit point B, would also go through the point C first. Also, let's say there is another stopwatch that tracks the moment when the laser beam passes through that point C. It makes me think that since the distance increases (the wagon is moving) then it would take more time for the laser beam to reach the point B. Which means that for the observer (who sits in that wagon) it would seem that light travels slower!
When it is said that the speed of light is constant for each observer, is it meant the objective light speed is the constant or the perceived by the observer one? If it is the latter then how come it is happening? If it is happening, then there is a mistake in my thought chain.
 A: In the frame of the train, the light arrives at Point C, then travels the length of the carriage before arriving at Point B. In the frame of the track, the light has travelled a greater distance, since the far end of the carriage (ie Point B) moves along the track before the light reaches it. Since the speed of light is the same in both frames, that means the time taken for light to traverse the carriage must be greater in the frame of the track than it is in the frame of the train.
The effect is a real one, not some kind of illusion. It arises from the relativity of simultaneity, which means that the plane of constant time on the train is tilted relative to the plane of constant time on the track.
The effect is entirely reciprocal. To see this, imagine standing together with a friend who flashes a light. The light moves off to the left and right at speed c so that at any instant it is equidistant from you in both directions. Now imagine you walk after the light to the right, while your friend remains in position. Since both you and your friend experience the same speed of light, that means that at any instant in your frame the light is equidistant from you, while at any given instant in your friends frame the light is equidistant from them- you each think you are at the centre of an expanding sphere of light. The only way that can work is if you and your friend disagree about what constitutes 'a given instant'.
To illustrate the effect, let's assume light travels a foot per nano second. From your perspective, after a nanosecond in your frame, the light is a foot away from you in either direction. From your friend's perspective, however, light that is a foot away from you to the right has travelled slightly more than a foot, since you have been walking to the right, while the light that is a foot away from you to the left has travelled slightly less than a foot from your friend. Therefore what for you are two simultaneous instants, both a nanosecond after the light has flashed, are two separate instants to your friend, one happening just before a nanosecond in your friend's frame and one happening just after.
Likewise, when your friend sees the light a foot away in each direction after a nanosecond in their frame, you will see the light slightly further away to the left and slightly closer to the right, so that will happen at two separate instants in your frame.
A: 
When it is said that the speed of light is constant for each observer, is it meant the objective light speed is the constant or the perceived by the observer one?

It means that the speed of light measured by each observer has the same value, about $3\times 10^{8}$ m/s.
In your example where $A$ is on land and $B$ and $C$ are on the moving train. If $A$ sent out a pulse of light from a laser beam, and could measure the speed of light by, for example, measuring the time for part of the beam to cover the first meter, then $A$ would measure $3\times 10^{8}$ m/s.
The beam would then pass $C$ on its way to $B$.  If $C$ could measure the speed of the pulse as it passed, by measuring the time for part of the beam to cover the first meter, then $C$ would also measure $3\times 10^{8}$ m/s.
Similarly when the pulse arrived at $B$, he/she would also measure the same speed.

If it is the latter then how come it is happening? If it is happening, then there is a mistake in my thought chain.

It's a postulate of special relativity that all observers will measure the same speed of light irrespective of their relative motion.
At first it might seem  impossible, and that's why you might think that there is a mistake in your chain of thought - but a consistent theory was developed by Einstein including the postulate.
Apparent contradictions are resolved due to time passing at different rates for different observers, changes to our notion of  simultaneity, length contraction etc...
A: Okay, look at it this way. Imagine a train that is 300,000 km long and there are clocks located at the front and rear. They have been synchronized.
Now the train whips by the train station at 260,000 km per second.
Those at the train station will notice that the clock at the rear of the train is ahead of the clock at the front by 0.866 of a second, and they will see that the length of the train at this speed has shrunk down to 150,000 km, and they also will notice that the clocks on board the train are ticking at half speed.
Those on board the train still think that the two clocks are still synchronized, and they still think that the spatial length of the train is 300,000 km long.
And so if a burst of light is sent from the rear to the front of the train, the observers at the train station will see that it takes about 3.73 seconds for the light to reach the front of the train.
This is because the light is only going roughly 40,000 km per second faster than the train. Thus 150,000 km divided by 40,000 km per second, equals 3.73 seconds.
But for those on board the train, 3.73 seconds becomes 1.866 seconds since their clocks are ticking at half speed. But due to the clock offset of 0.866, they will measure 1.866 - 0.866 which equals 1.000 second. Now since they still think that the spatial length of the train is still 300,000 km, they think that the light had crossed 300,000 km in one second, hence the speed of light.
A: I think that it might be helpful to take a step back from the math, and re-evaluate the question itself.
There is no why or how to the constancy of the speed of light: it is an empirical observation. The job of physics is to construct a theory of motion that fits observations of the real world as best as it can. For hundreds of years, the best theory was Newtonian mechanics, which you describe in your question. In the 19th century, as more precise measurements were made, it became clear that, contrary to the predictions of Newtonian mechanics, all measurements of the speed of light turned up the same number, regardless of the relative velocity of the origin and observer.
Einstein started with the assumption that the speed of light is constant to all observers, and worked backwards to figure out what laws of motion would lead to such a phenomenon while not contradicting other observations about the world. This requires discarding the straight-forward, intuitive model of how a bullet fired from a moving train behaves, and starting over: masses in motion do not have an "objective" velocity, you can't just add relative velocities together, and not even the passage of time is consistent from observer to observer.
A: In order to understand special relativity you must remove from your mind the idea of objective velocity, or time of an event or duration or distance. By doing this, Einstein was able to formulate a consistent theory in which light would always be observed (calculated) to be travelling at the same velocity ($c$) by any observer. There is no point in space that can be considered still in objective terms but only still relative to an observer in the same "inertial frame", i.e. who is traveling at the same velocity.
Light (in a vacuum) is always observed to be traveling at one velocity ($c$) in any experiment, whether it is in your own inertial frame or in another which is moving at high speed relative to yours. This is of course counter-intuitive. In Galilean (common sense) relativity a bullet shot from the front of a fast moving train would have a velocity relative to the track that is the sum of those of the train relative to the track and the bullet relative to the train. That is not the case when a beam of light is fired from the front of a fast-moving spaceship. An observer who is still (not moving with the spaceship) would calculate the light velocity to be $c$, the same as the observer on the spaceship.
To resolve this apparent paradox it is necessary to make use of time dilation, distance contraction, and lastly the non-simultaneity of events separated by distance in the direction of travel in a moving inertial frame. That would include that, clocks at the front and back of a long, fast-moving spaceship, which have been synchronised by a traveller on the spaceship will not be considereded to be synchronised by an observer at rest.
It should be mentioned that the train and the bullet in the above example are not exempt from the special theory of relativity, but their velocities would be such that the relativistic effects on them would be extremely small, and probably too small to measure by any conceivable experiment.
A: 
But why is it happening?

I suggest that you look at Einstein's paper On the Electrodynamics of Moving Bodies. Part I of the paper is quite accessible. It is the key to much of 20th century physics, because it introduced the idea that you need to measure something before you can really talk about it. If you want to measure velocity, you need to measure distances and times. If you set out from somewhere, say a specific door of the Empire State Building, we define that place to have coordinates (0,0,0), and the time that you set out is T=0. Easy. Now when you get to somewhere else, we measure the time at that place, but what does that actually mean?
Einstein developed an ingenious method for synchronizing clocks at different places using light signals: On the Electrodynamics of Moving Bodies is about the consequences of following this method.
NB: Einstein doesn't attempt to answer your question, though; he makes the constancy of the velocity of light into a postulate; we don't ask why all right angles are equal in Euclidean geometry, and we don't ask why the velocity of light is constant. How do we know that special relativity is a correct description of the world? It is the simplest theory that is consistent with experiment.
Fast forward 20 years, and Heisenberg invented quantum mechanics by analogy with Einstein's 1905 paper: if you can't measure it (even in principle), you have no business talking about it.
A: I will present a diagram (called a spacetime diagram) and explain what it shows. You will have to trust that I have constructed the diagram correctly. My aim is to show how it can be that two observers in motion relative to one another along a line can nevertheless find that something else (here a light pulse) moving along that same line can have the same speed as observed by both of them.

The diagram shows a region of spacetime with two clocks and a light pulse. Clock 2 is moving to the right relative to clock 1. Clock 1 is moving to the left relative to clock 2. The light signal is moving to the right relative to both clocks. At event A clock 1 registers 1 second since the light went past both clocks. At event C clock 2 registers 1 second since the light went past both clocks.
Event B is simultaneous with A according to an observer travelling with clock 1.
Event D is simultaneous with C according to an observer travelling with clock 2.
The main thing to note is that the lines AB and CD have the same length. This means that the two observers agree about the distance travelled by the light signal during 1 second.
That's it! That's how two observers in relative motion can find that a light signal has the same speed for both of them. The reason it is surprising to our intuition is that we are not used to simultaneity being different for observers in different states of motion. Newtonian physics would say that the lines AB and CD ought to be both horizontal on the diagram, and then they would have different lengths. That Newtonian way of constructing a notion of simultaneity does not match with what is observed however.
Note that for this result it is not necessary to mention either time dilation or Lorentz contraction. It is only necessary to understand how simultaneity is modified.
In constructing the above diagram I have used a symmetric set-up, where the two clocks have equal and opposite velocities relative to any observer whose worldline is vertical on the diagram. This symmetry is why one can claim that equal distances up the two clock worldlines must represent equal amounts of elapsed time for each. This is an example of the principle of relativity. Owing to this same symmetry the distance scales along the two lines of simultaneity in the diagram must agree. A question in the comments asks how distance is measured along these lines. Since they both have the same scale you can simply use a ruler. The line AB answers the question "how far away is the photon after 1 second, for observer with clock 1?" The line CD answers the question "how far away is the photon after 1 second, for observer with clock 2?"
A: You just stumbled upon one of the ultimate questions of out universe, that is, why do massive observers see massless particles (like photons that make up EM waves) propagate always at the same ultimate speed (that we call the speed of light) regardless of the motion of the observer?

the speed of light was created by Nature to be one, the number whose multiplication influences nothing. But the primitive people who lived in spacetime and moved by speeds much smaller than c=1 - along small angles in the spacetime - were not able to see that their speeds were particular fractions of the maximum speed.

The origin of the value of speed of light in vacuum
Intuitively it is very hard to understand, if you are standing still on Earth, and shoot a light beam, or you are in a train that is moving (in your example) and shoot a light beam, why will both beams seem to propagate at the same ultimate speed, as seen from both inertial frames (standing on Earth or moving with the train)?
If you want to intuitively understand why this is so, there are two very important things:

*

*massive objects always move at a certain speed that is a relative fraction of the ultimate speed of massless particles

Originally in the photon epoch, there were only massless particles and they were all zipping around at the same and only one ultimate speed, that we call now the speed of light. Certain particles gained rest mass, slowed down in space, and built us up, and now as we massive observers look around, see all massless particles zip around the this same ultimate speed still. Regardless how fast a massive observer is moving, its speed will always be relative to the ultimate speed, the observer will always move at a certain fraction of the ultimate speed.


*Massless particles/fields propagate independently of the source

Massless particles that build up for example EM waves, will always propagate independently of the source, this is very important, because no matter the speed of the massive object that emitted the massless particles, the radiation will propagate away from the source at the ultimate speed regardless of the original speed of the emitting object at the moment of emission.
Intuitively, you would think that when you put your hand into the pond, the waves will propagate (away from your hand) at a speed that depends on the original speed of your hand when you disturbed the water.
Though, with EM waves, it is different, because the speed of the radiation (wave) that spreads from the source (charge) that disturbed the fields is independent from the original speed of the source. The radiation will always propagate at the only one ultimate speed, the speed of light.
So there are two things to bear in mind:

*

*a massive observer is always moving at a speed that is a relative fraction of the speed of light, and will always see massless particles move at this ultimate speed


*EM waves (and all massless particles) always move independently of the source, at the speed of light, regardless of the original speed of the object that emitted them
The ultimate message of relativity is that speed (of massive objects) is relative, but the speed of light is absolute, and the massive (inertial) observer will always see the massless particles propagate at the speed of light.
This is the ultimate answer to your question and we do know that relativity is the correct framework because all our observations and experiments are best described by it.
A: A and B start in the same inertial frame of reference.
Observer A has a meter stick and synchronized clock.
Observer B has a meter stick and synchronized clock.
A and B observe a distant source of light or electromagnetic radiation. Both specify the same wavelength and frequency for the source. Speed is wavelength times frequency so A and B specify the same speed of light.
Taking their respective measurement instruments, which agree in the frame of reference, A travels toward the source at 0.5 the speed of light, and B travels away from the source at 0.5 the speed of light. A and B will both measure the speed of light as constant, neither will think the meter stick or clock have changed length or tick period in their respective frame of reference, but their respective measures of length and time are no longer equal to each other as they were when A and B were making observations in the same frame of reference.
A: To me, the key to understand special relativity was to view it as co-ordinate transformation, together with the notion that space and time aren't distinct things, but closely related.
Bear with me, take yourself a piece of paper, and follow me.
(To the experts: I'll first use a model that ignores the imaginary-number property of the Lorentz transformation)
Take your piece of paper and draw a co-ordinate system with t (time) horizontally to the right, and x (positions) vertically upwards. That's the "reference frame" that you'd like to call "static", non-moving.
As a non-moving observer at the zero position, you stay at the same position all over time, so your "track" is along the t axis.
Now a second person is moving with a speed of e.g. 0.1c in positive direction, then his track is a sloped straight line with increasing x for increasing time. If you scale the axes so that 300000km are as long as 1sec, then you get a slope of 5.71 degrees.
Special relativity says that this second person can't feel that he's moving, so he'd think that his track is the "correct" t axis, from his point of view. So he lives in  a different co-ordinate system, one with its t axis rotated by 5.71 degrees against your "static" one.
Let's have a look at the other axis. Your x axis doesn't form a 90 degrees angle with his t axis any more. So, to get a valid "moving" co-ordinate system, we have to rotate the x axis as well.
What does that mean? The x axis is all the events (spacetime points) that happen at the same time. As you and the other person now disagree about the x axis, it means that things that happen "at the same time" for you, have a time difference for him, if they happen at different x locations.
Now, if you shoot a ray of light from the zero point and observe it at some distance, then you and the other person will not only disagree about the distance travelled, but also about the time it took. And it happens for the speed of light that these differences in both distance and time compensate one another, so that we always observe the same quotient.
(And here come the unintuitive parts of the transformation)
One question remains:

*

*What is the correct scaling factor between space and time? The one that explains the experiments showing a constant speed of light, no matter how fast the observers move?

It turned out that no real number, used as scaling factor, did the trick, but a complex number did (speed of light, multiplied with the imaginary unit). With this factor, the co-ordinate transformations got the special property that the 45-degrees speed-of-light diagonal on our sheet of paper always stays a diagonal (okay, that is counter-intuitive, but if it were intuitive, it wouldn't have taken an Einstein to discover it).
A: The intuition can be obtained if you understand the retarded time. For a stationary body producing light and another body moving close to C , you are evaluating the field at the retarded time in a sphere around the emmiter  thus the moving body is moving out of the horizon of the retarded time bubble, thus I measure that it takes longer for the field to be updated for the moving body. But from the moving bodies perspective  When the emmiter produces an acceleration  in his perspective, he is stationary and the emmiter is moving close to c  so at the instant it produces light, the retarded time bubbles move out from that initial position . in the stationary frame it takes longer for light to reach the moving body as he is moving out of the horizon of the retarded time.bubble, but in the moving frame, he  is stationary relative to that initial retarded time bubble. thus we can also conclude that the time has slowed down for the moving body as e.g light takes 1 second to reach him, but 15 seconds for the stationary observer
A: The question is why the speed of light remains always constant in all reference frame regardless of any motion into consideration? You want some Fundamental reasons? Because Einstein said it, because it was proved by different experiments ( that I dont understand clearly); nothing more needs to be said.
Hmm, if you want to know something interesting, then keep reading. I personally dont like this idea cause it makes non sense. Just giving a little Thought Experiment.
Suppose you are standing and saw a car to pass by. You have measured the car speed as 20 meter per second. Now another person was running 5 meter per second at the same direction of the car. He will measure the speed of the car as 15 meter per second from his perspective.
Now lets say you are standing and a light passed by you at the same direction where the runner and the car are moving. You measured the light speed as 3 lac km per second ( rough estimation). The person who was running 5 meter per second measured the light speed as 3 lac km and not 3 lac km minus 5 meter per second. The car also measured the light speed to be 3 lac km per second though it was moving 20 meter per second. Ok now lets assume the runner is a superhero known as Flash, a justice league member. He started running at the speed 2 lac km per second towards the light direction. Now our common sense says that the light speed that Flash will measure will be 3–2=1 lac km per second. But as light speed is constant, theoretically he will still measure the speed of light to be 3 lac km per second.
Now suppose the standing person was Superman. What he will observe? Light speed is 3 km per second and Flash is going through a time dilation? Ok even if you interpret this from abstract concept, lets see how you take the next point into your account.
Now Superman started moving opposite to the direction of Flash at 2 km per second. What he will observe? The light speed is still 3 km per second moving, right? Because light speed is constant, right? But the speed of Flash is not constant. So he will see Flash to go at the speed 4 km per second exceeding the light speed!!!
Boom, kabooooom!!!!!
The Biggest Paradox of 21st Century…
A: I've always found it helpful to remember that the observed photons may have the same velocity c, but different energies/momentums.  Hence blue/red shifting.
