pretty much just watch what others are doing. if there is a really good vibe in the pit then that's cool, if there is one random guy acting like a fool and causing trouble then just steer clear of them...
In most crowds at gig's you're going to find five distinct areas.
The crush (right at the front, if you're here expect to stay here and don't expect to get anything to eat or drink, it'll be difficult to get out, and impossible to get back to where you were if you leave).
Circle pits, (where people are literally running round and flailing in a circle, (which as you'd imagine is a lot of fun, but can lead to a lot of pain).
Mosh pits, (where people are jumping around (probably again is a circular opening in the crowd) but not as violently as in the circle pits. so again, lots of fun, but you can fall over and get hurt.
then there is the general crowd where people might be moshing or jumping up and down or dancing. -not much chance of getting hurt there unless you loose your footing
then there are the old people at the back that just stand still and listen to the music.
pretty much no chance of getting hurt there, but you've plenty of opportunity to actually talk to people, make new friends, go to the loo get a drink and it' nice and easy to find each other again.