If you mean by "how", how can the master read the voltage level on the SDA pin and also use it as an output, don't forget that on most (all?) microcontrollers, when a pin is set as an output (whether that be push-pull or open-drain) the input circuitry is not actually disabled, so you can still read the state of the pin. You'd normally just be reading back whatever state you last put the output in. But in the case of I2C, where the MCU pins will be configured as open-drain outputs, other devices on the bus can independently affect the state of the line, so the output state might be commanding 'high' but the pin input actually reads 'low'.