Einstein wondered about riding a beam of light--but another good question might have been about riding a wave of light. Light travels in waves that radiate outward from the source of light. Until Einstein, most scientists thought that light behaved like other waves, such as ocean or sound waves. According to this logic, light waves traveled through some sort of "medium," just as ocean waves traveled through the medium of water.
Nineteenth-century scientists didn't know much about the medium for light, which they dubbed the "luminiferous ether." No instrument could find the mysterious substance. But scientists of the day believed that the speed of light should be affected by how fast the source of light was moving through the ether. They believed that light from a source moving toward you (say, the headlight of an approaching train) would travel faster than light from a stationary source (a signal light next to the tracks).
For decades, physicists searched in vain for the ether and proposed elaborate explanations for why they couldn't detect it. Einstein suggested a more radical notion: the long-accepted theory that light moved through ether was simply wrong. He declared that there is no ether to speed up light or slow it down--in other words, the speed of light is constant. Einstein's bold proposal has survived all tests to date: Every experiment to measure the speed of light in a vacuum (space devoid of all matter) shows that it is indeed constant for all observers.