The reason Sheldon knocks 3 times is :
When he was 13, he came home early for spring break from college and heard sounds coming from his parents' bedroom. He opened the door and saw his father having sex with another woman. Since then, he has always knocked three times before entering a room because one is traditional, but "two and three are for people to get their pants on," which is actually uncommonly considerate behavior from Sheldon. He and his father never spoke of the incident.