The Gestalt law of similarity refers to a sub-field in psychology called Gestalt psychology. The sub-field believes that humans seek to perceive reality by understanding something globally instead of discretely – paying attention more to the whole than the sum of its parts.
Thus, we tend to group things that are (A) alike together, including in shapes, sizes, and even colors. The tendency to categorize things that are alike is explained in this law.