Is 'photons being massless' the reason everyone observes their speed to be the same? When a man on a train throws a ball, the resultant velocity of the ball (as seen from ground) is the sum of the velocity of the train and the velocity imparted to the ball from the throw.
However, if a man on a train shines a torch, the photons that come out never inherit the speed of the train.
Is this because 'photon are massless, so the train isn't able to transfer its momentum to photons'? 
 A: No. You don’t have to have quantum mechanics (i.e., photons) to have special relativity. Even when the light from the flashlight/torch is described as a simple classical electromagnetic wave, it still has the same speed for all inertial observers.
The fact that high velocities don’t “add” and “subtract” the way you intuitively think, based on your experience with low velocities, has nothing to do with massless quanta. It has to do with spacetime having an unintuitive geometry, namely Minkowskian. Lorentz transformations are to this Minkowski spacetime what rotations are to Euclidean space.
The speed of light is not fundamentally about light at all. It’s an unfortunate historical misnomer. There would be a universal speed limit even if there were no light, and even if there were no massless particles of any kind to move at that speed.
A: Even though they are massless, photons have momentum, and the photons from the torch do inherit the momentum of the train. It doesn't change their speed, but it does change their frequency. 
If the man shines the torch forward, its colour will be redder for observers on the ground in front of the train. If he shines it backwards, the colour will be bluer for the observers behind the train. This is the (longitudinal) relativistic Doppler effect.

FWIW, the energy of a photon is equal to its frequency times Planck's constant:
$$E=hf$$
The energy of any body is given by Einstein's equation:
$$E^2=(pc)^2+(mc^2)^2$$
where $p$ is momentum, and $m$ is mass. A photon has zero mass, so that equation simplifies to
$$E=pc$$
For a particle at rest, we get the more famous form of Einstein's equation:
$$E=mc^2$$

To calculate the combined effect of two linear motions, you can't just add the speeds together. That's a fine approximation at low speed, but it doesn't work when the speeds get close to $c$. The correct equation is
$$w=\frac{u+v}{1+uv/c^2}$$
If we let $u=c$ then
$$w=\frac{c+v}{1+v/c}=c$$
So a photon traveling at $c$, launched from a train traveling at $v$, has a speed of $c$ in the frame of the ground observer.
A: In the standard model of particle physics, of which the photon is an elementary particle, all massless particles travel with the speed of light. In the quantum mechanical theory that describes the predictions of the model,  this is ensured because the Lorenz transformation  axiomatically holds for its equations.
Light, as in the torch, is made up by a quantum mechanical superposition of zillions of particles, but the classical electromagnetic theory also obeys the Lorenz transformations, so light also travels with the velocity of light:).
These theories, the classical and the quantum are continually validated.
That the velocity of light is fixed in vacuum is another story and comes because of the Michelson Morley experiment.
A: There are two misconceptions lurking around in your question. One is about relativity and the other is simply about wave mechanics. 
The Relativity Part

"When a man on a train throws a ball, the resultant velocity of the ball (as seen from the ground) is the sum of the velocity of the train
  and the velocity imparted to the ball from the throw."

No! It is never the sum. However, if the relevant velocities are small, one can approximate the actual non-sum answer with a sum. So, if one throws a massive ball with a speed comparable to the speed of light, despite the fact that the ball is massive, the approximation of summing up the velocities of the train and that of the ball with respect to the train wouldn't work. The law that combines velocities is a geometric law--it is the same law for all kinds of velocities. Whether they are velocities of particles with masses or no masses or of entities that are not particles at all, for example, waves. Whether the approximation of summing up the velocities would work or not depends on whether the velocities are comparable to the speed of light or not--not on the mass of the particle per se. 
However, there are certain restrictions on what velocities a particle can attain depending on whether it is massive or massless. One can show under rather general considerations that a massless particle must travel at the speed of light. Thus, it is clear that one has to use the full relativistic version of velocity combination law for massless particles--and not the approximate non-relativistic formula. So, that is why relativity becomes glaringly manifest in the case of massless particles.
The Wave Mechanics Part
Now, the fact that the speed of the electromagnetic waves emitted from a torch traveling on a train doesn't depend on the speed of the train is not a unique feature of relativity. It is a general feature of waves that their speeds don't depend on the speed of their source but only depends on the medium that they travel in. For example, the speed of the sound waves (wrt ground) emitted from a speaker traveling on a train would be the same as the speed of the sound waves (wrt ground) emitted from a speaker at rest on the ground. 
What is unique about light is that the speed of light is not only independent of the source from which it is emitted but, it is independent of the observer. For example, even if the speed of the sound waves (wrt ground) is the same whether it is emitted from a speaker traveling on a train or from a speaker at rest on the ground, the value of its speed changes depending on the observer (not depending on its source but depending on the observer). This is to say that if the speed of sound emitted from a speaker at rest on the ground is $x$ wrt ground then the speed of sound emitted from a speaker mounted on a moving train would also be $x$ wrt the ground. However, if a train is moving at a speed of $y$ wrt ground then the speed of sound wrt train would be approximately $x-y$. This is what is not true of light. The speed of light is $c$ wrt both the ground and the train. This is because the non-relativistic approximation doesn't work when one is dealing with speeds close to the speed of light.
A: The fact that the electromagnetic field is massless is part the reason why the speed of light is always observed to be the same. However, the full reason also includes special relativity.
A: On a stationary train send a photon vertically toward a mirror on the ceiling and record the time required to make the entire trip from floor to ceiling and back to floor.  Now do the same for a moving train with the photon emitter attached to the train and again send the photon vertically.  The fact that the second train is moving horizontally has no effect on the time of the vertical round trip.  The photon seems to take a longer total trip on the moving train because the horizontal side transport momentum is added to the photon by the train when first emitted.  To keep the speed of light constant at "C" for this longer trip requires a time dilation patch.
