Why do pitches separated by an octave sound “the same”?

Why do we perceive an identity between all auditory frequencies related by powers of two? How did we arrive at the notion of pitch class, as opposed to absolute pitch? Is there some evolutionary reason for octave equivalency? Humans aren't the only primates to possess it; rhesus monkeys do too.