How does the iPhone screen work?

How does it know when a finger is touching it opposed to a pencil? Does it have some sort of heat sensor?

It senses the static electricity from your fingers; this type of technology is known as a capacitive touchscreen.

It does not sense a hard object because it does not have a static-electric charge, however, if you are touching a metal object and that object is touching the screen, the electricity from your fingers will conduct through the metal to the screen. This is also why some gloves have conductive thread--to be used with iPhones.

Just take your time and your natural intelect will teach you anything you want to know

The screen senses the magical power of your finger: D btw you disable your pm box so I couldn't respond to your last email.