Yes the x-ray machines detect the liquids when scanning your luggage. Not taking the liquids out of your hand-luggage will not raise any issue in those countries in which it is not mandatory to do so. However, in the remaining countries, your luggage will either be placed on a separate conveyor belt coming out of the x-ray machine, or will be pointed at by the security officer manning the machine, and will be hand inspected by the airport security staff. Needless to say they will enforce the rules. Moreover, this will ensure you lose at least fifteen minutes of your time whilst all the checks are completed. The UK is one such country. Last time I flew out of EDI, there were signs explicitly stating that failure to remove liquids from hand-luggage would result in extra, and lengthy, security checks.