In the base game, the technologies are split into 3 groups, 0, 1, and 2 (tech.id %3 gives the group). Each tech you acquire increments the hidden group by 1, cycling between the 3 groups. However, the tech with the lowest id number is always available for research, even if it "should" be hidden. I'd guess that tribe.numTechs%3 == tech.id%3 determines the techs that are hidden, but the game might use some other count of the number of technologies.
Tech hiding is important in early game strategy for the base game, since Monarchy (or sometimes Republic) should be achieved as quickly as possible. The tech tree happens to be set up so that one "off path" tech must be researched on the way to each of these governments. Ideally, you get that tech from a hut, but then you may want to avoid exploring other huts (or getting techs from other tribes) until you have Monarchy, since a second off-path tech might hide the on-path technologies again. I forget the exact details. But this was also one of the reasons Great Library is held to be a wonder that can actually be harmful, since it can disrupt your planned technology path (not to mention, you have the increased costs of the worthless technologies).