It does it just like Pavlov's dogs. Society teaches people from the moment that they are born what is right, how to dress, and much more by actions. For example, if a 24 year old woman went around picking my nose in public society would react by giving me nasty looks. Possibly even going up to the women and correcting her behavior. The women would react by not picking her nose because she wouldn't like the nasty looks others give her. Of course, people can get really in depth on this subject and this explanation of conditioning is just one of many theories found in sociology and psychology. People also live by society's rules. What they should look like, how they are supposed to act, etc.
The topic of society affecting identity seems to be a much more important idea than most people give credit for. Next time you think of how society affects a person's identity , think about what you just read and think of what society is doing to a person. It is likely you under valued the part society plays in molding a person's identity before, but will now start to give the credit