The kanji? for "koan" (関) is an abbreviation for "ko-fu no an-toku" (公案). In ancient China, this was a signpost on which new laws were announced to the public. In much the same sense, a koan states a realized principle, or law of reality.
Koans are used almost exclusevly in Ch'an? (Chinese) and Zen (Japanese) schools of Buddhism. There are compilations and commentary written with respect to koan. Two notable collections of koan are the Gateless Gate and the Blue Cliff Record.
In Ch'an and Zen schools koans are given to students with respect to difficulty and ability of the student to "break through" and directly perceive reality with the "wisdom eye", which is the foundation of the Ch'an school.
See Zen, Ch'an?, dharma or dhamma