When the rubber sucker is pressed against a flat, smooth surface, its concave rubber cup gets flattened to a large extent, pushing out most of the air from beneath it. So the air pressure inside the rubber sucker becomes very low and the much greater atmospheric pressure acting on it from outside fixes the sucker firmly on the flat surface.