In a way it doesn't, there is a sensor/switch for low oil in the tank, similar for if the oil "pump" receives a signal that it should pump, there is various systems of course, simple carby models mix oil with the fuel at prescribed amounts, EFI types inject measured amounts into the engine itself, it's a bit more complex, but in simple terms, that's how it works.
edit, that should probably read DFI types!