At the edge of death, some people wake into sudden clarity. Terminal lucidity is one of the mind’s most baffling mysteries.