So all of these rules about what is Kosher, about things you can't do on a Saturday... Where did they come from?
AvalonXq is basically right. Let me add my two cents. They start from the Torah (first five books of the Bible).
Then, they got analyzed over the centuries, where various scholars decided how to apply them to their times and their circumstances. The two most influential sources are the Mishnah and the Talmud, which I believe were finished by about AD 500.
Obviously, the Talmudic scholars didn't anticipate weight sensors in elevators, so as technology changed, they tried to figure out what to do. The differing opinions are in part what led to the different branches of Judaism today.
The Orthodox branch basically believes the laws were sent from God and must be followed rigidly. When something comes up that isn't covered explicitly, they generally say that you must not take any chance that you might possibly break the rules, so they tend to be more expansive in the prohibitions. They refer to this as "building a fence around the Torah".
The Conservative branch basically believes the laws came from God, but maybe not so directly, and that if something comes up that isn't in there, you should think about it a little bit, but unless it's expressly forbidden, you're ok to do it.
The Reform branch basically believes that the laws came from men, although men who were very much spiritually connected with God. They represent a good set of rules for goatherders 3000 years ago, but things have changed, and each person should try to apply the principles of the law in their own lives today.
The apparently strange rules, like pushing elevator buttons, generally come when rabbis get together and discuss things, and then issue their rulings and interpretations, which members of Orthodox communities are expected to follow.
Or was it a case of gradually accumulated man-made rituals from the various tribes eventually becoming traditions, then rules, then God's Law?
Presumably. That was pre-Torah stuff, and is mostly lost in prehistory.
And what's with the funny hats ?
Jews are required to keep their heads covered. The specific style of hat is pure cultural tradition. Religiously, it's ok to wear a yarmulke (kippah), or a baseball hat. Some specific groups have cultural traditions for using particular kinds of clothing or hat.