- Analyze how bad the damage is.
a) He can beat me in an all in, but otherwise can't significantly outtrade me or kill me without ganks.
b) He can hard outtrade me, getting near creeps means losing 1/3 or 1/2 of my HP.
c) He can straight up kill me if I walk to the wave.
d) He can and WILL dive me under tower from 100%.
- Analyze what your resources are.
a) Do you have the ability to clear the wave quickly (and still pick up most of the CS)?
b) Do you still have your tower? And is it a reasonable deterrent from dives?
c) Do you have TP?
d) Do you have a jungler who isn't behind and is willing to help?
If you have 2a, you're pretty solid in any situation except 1d. Just back off the creeps until he's cleared your creeps, then farm what's left (usually there will be 5 creeps left unless he slow pushes, then 4 are left). This still equates to 8-10 CS/min if you can get it all, a GREAT count. If he's really in your face, do it under tower. Most top laners with AoE damage can clear the wave and tank the creeps, to prevent the wave from bouncing. If you don't have that option, just farm under tower since the damage you take might not be worth the CS. Mid laners with good wave clear can do the same at the cost of 1 potion (which isn't as good of a trade as it used to be, since they cost an extra creep worth of gold now). If they're in your face, just farm under tower. You should probably still be able to manage 8 CS/min if you can clear our the ranged creeps (3 ranged creeps and 1 melee per wave under tower; not optimal, but sufficient to stay in the game).
If you don't have 2b, things get pretty bad unless you're at 1a. You have to yield a lot of space to the enemy team to safely farm. And you can't push further than the river (meaning just past where your first tower used to be). If you're at 1a, then basically it's a longer (more dangerous) lane for you, but it's 100% safe if you just play a normal laning phase on the safer side. 1a means you should avoid tons of trades and focus more on farming, but you should not be afraid to return damage when they trade on you (just don't all in or keep trading once you've used your CDs; basically, don't let the trade damage be free for them).
With 2c, you're in a pretty good spot on anything except 1c and 1d. You're in a great position if it's just 1a, and a playable position with 1b (more of a gamble with 1b though). Basically, you can either use teleport to keep up high farm numbers to make up the gold difference, or you can look for a TP play. A TP play with unshared assist money (meaning 2 people to get a kill) equates to a little over a wave's worth of gold, and slightly less experience FOR YOU. But for your ally, it's ~2.5 waves of gold, whatever is left in the lane, and denying whatever is left for your opponent +1 wave. In the event the jungler doesn't take this, it's around -1.5 waves for the enemy, +3 waves for your mid, and ~+0 for you, meaning a net 4.5 waves of gold in favor of your team. From there, you MIGHT be able to move on to an objective. Most likely though, you should make your way immediately back to lane (walk if you TP'ed mid and have most of your HP left 70%+, probably base then walk to top if you TP'ed bot, walk to lane if you're the mid laner). Yes, it didn't help you massively, but it helped your team massively. That 4.5 wave net loss is all in 1 lane. That's 29 CS, which is 550-600 gold. This is just with 1 kill. If you get more, it's even better. Basically, the idea is just survive the lane without losing too much CS/HP, then look for a TP play. Look for when players overcommit (use their dashes/disengages, like Cait Net, Ez jump, Trist jump, etc) or when jungler comes in. Looking for when the jungler shows is the easiest to see and turn. Looking for when players overcommit is harder, and could potentially be too late since they should only do that if they think they can get the kill. Same concept applies if you don't have TP, it's just a bigger risk.
2d is much the same as 2c, except the play is on your own lane. Be sure (or pray) that there is no countergank, and you should be successful in anything other than 1c and 1d. In the case of 1c, you could possibly go 1 for 1, which is a net gain for your team (450g to your team, 300 to the enemy, plus the CS gains and denials in the lane). But it doesn't do much to help you unless you get the kill and CS (and hopefully buff transfer). It could also potentially turn into a 2 for 1 or a 2 for 0. Anyways, avoid chancing it if you can get plays elsewhere.