It really depends on the type of sensor you’re talking about. A sensor is often used as an input device, something to tell a computer what is happening in the real world. So often they are converting some signal or input (light, heat, pressure for example) into some electrical signal.
For instance, and LDR (which stands for Light Dependent Resistor) can be used to sense light levels. It is a tiny little electronic component, smaller than a pea, that allows electricity to pass through it. But when light hits it, the chemicals inside the LDR change and allow more electricity to flow through (the resistance decreases). By monitoring the amount of electricity that can pass through, you can tell how much light is hitting the LDR, and can therefore sense the light levels around you!