What is the proper age for children to begin being taken to Shul?
I take my kids starting at about 1 month old. They sleep at that age, but I still feel the tunes enter their subconscious. They stay with me until about 2 when they start going to groups only coming in for Ein Kelohenu until the end. The groups are age appropriate and all do appropriate davening for the age group, they are all very excited when they get to daven from a real siddur at age 5! They love coming to shul and truly know the prayers!
I am in favor of the earlier the better, but the length of time they can stay in depends on the child.
My 3 year old boy would rather sit with me in shul than go to groups. I bring a bag of books for him (I won't take toys to shul, only books) and he looks through them. I warn him before the Rabbi speaks that he has to be extra quiet or he can go to groups, he always sits on my lap and 'listens'. He loves kissing the Torah. When I tell him I have to daven he doesn't even touch me, but when I am done with Shmonei Esre in Musaf I do hold him so he can see the men's side as well.
Basically- the earlier the better, they learn proper decorum, they learn the nusach, and they learn the prayers.
For a boy, 8 days (snark). For a girl, whenever she's ready.
In short, there is no fixed rule.
It is appropriate, however, to start educating children from a young age and acclimating them to their Jewish environment. I cannot remember the "original" source, but R' 'Ovadiah MiBartenura writes on Pirkei Avoth, Chap. 2, Mishnah 8 or 9 (or possibly even 10 or 11, depending on the edition), that the mother of R' Yehoshua' ben Ḥananyah (although in this context it might be prudent to give her the credit) used to take him as an infant to the Beith HaMidrash to expose him to Torah. She did the same while she was pregnant with him.
Each child is obviously different. Rav Shlomo Wolbe wrote in Zeria uVinyan beChinuch that aside from young children disturbing the congregation with their playing, a child needs to appreciate the more mikdash. If a child is too young to feel this, the parent should not bring him. The longer we delay the child's visit to shul, the better his long term relationship will be with the shul. (He also says not to take children to a shul with talkers or to a yeshivishe davening because it's too long for the child to sit through.)
Here are my personal experiences:
(Note: My girls do not go to shul. My Rebbi's wife said that "in Europe", the girls only went to shul for Shabbas Kallah. In addition, this promotes the problem of kids being around the shul as the wife feels she has to go to shul.)
My son started coming to shul mid-2nd grade, but only at the end. If his davening from school was 15 minutes, he came 15 before davening ended and worked his way earlier as his davening got longer.
Eventually he became embarrassed walking in in the middle, which was a good time to teach him about coming on time. He now comes with me on time (7:30). Since shul is still a little too long, he has scheduled breaks.
Important: Do make a distinction between the makom tefillah and the rest of the building. That way if he does go to play with his friends, he knows the moreh mikdash still applies when he returns.