When playing on Deity, you will almost certainly need to research a tech or two yourself in the first 20-30 turns, critical starting techs that you lack such as Bronze Working, Pottery, or Ceremonial Burial. After that, you are almost always better off in setting science to 10% for 40-turn min science work on one tech, Writing generally being the best choice. You can use your income made over this span to buy (and hopefully broker) contacts, found embassies once you get Writing, and buy techs you missed at last-civ prices. I personally like to run a second 40-turn min science strategy on either Literature or the Republic after that, since both are expensive techs that are critical to have.
By this point in time, you are a long way behind in tech but that's perfectly natural for Deity. During the Middle Ages you either build up your civ infrastructure or fight a war to gain more territory, possibly both if you are lucky. I usually am trading away excess luxuries and resources (and even non-excess ones) in exchange for techs at last-civ prices. By the time the Industrial Age rolls around, you should have a chance to begin your own research, going after techs the AI usually ignores like Sanitation, and trading them around to stay caught up in tech. By the late Industrial Age, it's possible to get a slight edge on the AI civs, although you will never be able to leave them in the dust on Deity unless they are absolutely crippled by intercine warfare.
The basic strategy though is to reasearch one or two early techs at full tilt, then buy techs for a very long time while running a min science strategy or two, finally turning on research again at some time in the Industrial Age and staying in the lead or close to it. I have no trouble staying ahead of the AI on any level other than Deity, so I'm not going to mention them here; you can likely follow the same strategy to good effect on the other levels.