In Shang and Chou times, you could not change your place in life. Whatever your father was, you were, and boys were taught by their fathers. The only exception, for boys only, would be to join the military, and that was not usually a move up. If the city was attacked, the craftsmen and merchants were not brought inside the city walls. They were not considered important enough. They were left to fend for themselves as best they could. Girls were taught by their mothers how to be a good wife and mother.
Sons of nobles could learn from a tutor, who taught small groups of privileged boys. Tutors were paid. One such teacher was Confucius.
In Han times, school was free for boys. At one point, over 30,000 students (all boys) were enrolled. Girls from both rich and poor families could not attend school. It was not allowed. The ancient Chinese believed it was a waste of time to educate a girl because their opinions did not matter. Girls could be taught at home, but even that was rare.
In Tang times, people came from as far away as India and Korea to study the arts in China. There were special rooms in the imperial palace for training. You had to have talent, but the opportunity was there. The Job Market: Things changed in government, as well. Under Tang leadership, you did not have to be a noble to get a good job. You did, however, have to pass an examination. Examination Day was a big deal. It was everyone's chance to move up in the world. The roadways were crowded with carriages arriving at the examination hall. People came on foot. Everyone wanted to take the exam. Those who passed were assigned a job in the capital or in one of the many smaller towns in the countryside. Since girls did not go to school, and usually could not read or write, they could not enter government service, because they couldn't pass the exam. In ancient China, a girl's future was to married and have kids of her own.