How do you figure out how much oil to use for pan frying?
As you suggest, there are a number of factors, but the best rule of thumb I've found for pan-frying is to use just enough oil to cover the bottom of the pan by swirling it around.  In general, you don't want puddles (you'll get splashed with hot oil), but if the pan isn't covered then your food might not get cooked evenly.

These days I mostly just eyeball it, and err on the generous side.  Using slightly too much isn't likely to hurt your dish - unused oil just won't get absorbed - but using too little will result in under-cooked or inconsistently-cooked food and probably a lot of gunk stuck to the bottom of your pan.  So if you're not sure, just add a little more than you think you absolutely need.