So many fantastic reviews for this episode, but with all the talk about computers and the science fiction themes it's interesting that no one has commented on the moody and atmospheric way it draws on classic American literature.
Think of Shirley Jackson's story "The Lottery" the next time you watch this episode. Notice the sharp contrast between the outwardly virtuous small town life and the mindless violence the people throw themselves into with wild abandon whenever the Red Hour comes around. Think of Hawthorne's THE SCARLET LETTER. (Or even his short stories "Young Goodman Brown" and "The Minister's Black Veil.") The townspeople are all suspicious of outsiders, and pretend to fear their immoral ways, yet beneath the bland facade (like the black veil of the minister) they're all concealing some really unspeakable goings on.
I first saw this episode as a little kid, and what really struck me was not the computer stuff at the end but the haunting atmosphere at the beginning -- the New England accents, the string ties, the brutal violence under the fatuous hospitality. This is a very American episode of Star Trek, with roots that go all the way back to Plymouth Rock!