Almost all teams in Naruto have 1 female and 2 male members. For example, Kakashi's team (Kakashi, Obito, Rin) and Jiraya's students (Nagato, Konan, Yahiko). Is there any rule behind this?
I don't think there is any rule behind this because the main motive behind this is to test the dynamics of teamwork but there is one rule that is to how to team-up Genin:
Genin are put in four-man cells, or squad, consisting of three genin and a jōnin-sensei, in order to learn teamwork and experience true ninja life under the supervision and protection of an elite shinobi. The make-up of these teams is based on the individual skills of the genin, so that there will be a balance between the teams. For instance, Naruto Uzumaki, who passed with the lowest grades, was put in a team with Sasuke Uchiha and Sakura Haruno, who passed with the highest grades and highest written exam scores, respectively.
So there is nothing states that there has to be one girl in every team. But to create a perfect balance between all teams they might have assign one girl in every team.
To expand on the answer that was posted by Light Yagami, if there is any such rule in Konohagakure (hidden leaf village) it certainly is not universal, Team Samui from the hidden lightning had two woman and one man. Team Shigure and Team Oboro from the hidden rain were both all male. These deviations from the 2 men 1 woman structure even exist inside the hidden leaf on occasions. Team Ino–Shika–Chō was made up of Inoichi Yamanaka, Shikaku Nara and Chōza Akimichi was an all male team.
In episode 361, the third Hokage discusses why he assembled team 7 the way that he did, and he has a flashback of an incident with the Sannin back when they were Genin; where the underachieving Jiraya is motivate to try harder in an attempt to attract the attention of Tsunade in the same way that the over-performing Orochimaru had. In the subtitled version he says "Talent attracts people, men notice women and rivalry matures both, so they say." Kakashi then reminisces of his own experience with Obito being desperate for Rin to notice him.
So while it appears there is no solid rule that all teams should be two guys and a girl, both Kakashi and the third Hokage clearly believe there are benefits to this arrangement in at least some groups and it is likely the preference of the third Hokage to make teams in this structure whenever possible.