With stainless steel pans you can perform a water test to see if the pan is the correct temperature for frying but how do you tell with a non-stick pan?
You shouldn't heat a non stick pan without the oil, because it is too easy to overheat it and ruin the coating.
So, I put oil inside first, and tell by the state of the oil. It smells, looks and flows different when it is hot enough. You can also learn to judge if there is sufficient heat when you hold your palm at a given distance above the pan, but in my experience, you learn to judge by the oil before you have gotten good enough to keep the same distance and to distinguish "enough" from "not enough" heat.
If you don't have enough experience to know when the oil is ready, you have to do it repeatedly until you learn it. It takes a few less-than-great meals if you do it purely by trial and error, and goes better if you use an infrared thermometer. You can also try floating cubes of stale white bread and watch their browning behavior, but I find this method too involved logistically - you have to have the bread, cut it, then deal with messy pieces of oily bread, and end up with slowly charring crumbles in your pan.
Just put in a little test piece of whatever you're frying. (e.g. a small piece of onions if you're frying onions)
You'll be able to tell the right temperature from its colour (Is the onion staying white? Too cold. Turning golden? Great. Turning brown/black? Too hot.) and its sound or behaviour (e.g. medium sizzling).
I tend to put some oil in.
Then to test if it is hot, I throw in a few drops of water. Just by running my hand under the sink, and giving it a flick.
If it spits, then it is hot.
I'm not too sure on the exact science of it.
but clearly it does indicate the oil is hot enough to boil a few drops of water.
and thus the pan is too.
Big downside of this method is that you now have oil with water in it, and it may keep spitting. (Esp if you used too much water)
For frying, you're dealing with oil, and oil is actually easy to tell when it's hot enough, no matter the type of pan:
For sautéing, look for the oil to 'shimmer'. The surface of the oil will start to form tiny waves in it when it's sufficiently hot, causing odd reflections / refraction (but if you wait too long after that, it'll start to smoke).
You can also take a piece of whatever you're cooking, and press a corner of it into the oil. If it's hot enough, some of the water will instantly turn to steam and you'll hear sizzling.
For deep frying, you typically don't want it to get quite as hot as sautéing, so you can't rely on the shimmer. The food trick will work if the food is wet enough, but I prefer using a wooden utensil (wooden spool, skewer, etc.) and putting a bit of it in the oil. If the oil is hot enough, you should see little bubbles forming around the wood that's in the oil. (don't soak the wood, just use whatever natural humidity there is ... although this might not work if you're in a desert)