I've been to and played a few concerts in my life and there seem to be some people who just don't know how to act when they're at a concert. Here's a list of do's and don'ts when attending a concert, whether large or small.
1. Simon says
Whatever the artist tells you to do, you do it without hesitation. Nobody likes it when a singer tells everyone to lose their minds to the next song and then everyone just stands there, and no one wants to be that singer, trust me. So, take the initiative. When they tell you to dance, dance, when they tell you to slow dance, grab your partner, and when they tell you to clap, clap. It sounds easy but it's a lot more difficult when you're the first/only one doing it, so make sure your friends are going to back you up or else you're going to have a bad time.
2. Forget there are other people
It's hard to lose yourself in the music when there are people looming over your shoulder. My advice? Ignore 'em. Who cares if you're dancing to your favorite song in public? It's why you came in the first place. It's why concerts exist, you are meant to have fun at them, so go nuts! Plus you're probably not going to see these people again and they'll have no real bearing on your life.
Note: If you're at a local venue that you go to frequently, then you are going to see your fellow concertgoers again, so learn some names by show #3. You'll feel more comfortable going to shows if you know you're going to see some familiar faces there.
3. Don't completely forget about other people
Yes, I know I'm contradicting myself, but this is important. Don't treat other people as if they're invisible, and if you plow into somebody while dancing, apologize. Nobody likes it when some self-entitled person knocks someone over at a show and just keeps moving like it didn't happen. That's how fights happen. So play nice.
4. Safety, safety, safety
Look for emergency exits whenever you go to a new place and figure out an escape route. Find out who to grab a hold of (staff, event security, or the owner) in case of an accident or an emergency. If someone gets hurt in front of you, it's your responsibility to get them off the dance floor or the pit and to a safer location unless you're told otherwise by someone who works there.
It's actually quite easy to tell when someone gets seriously hurt in a pit. Listen for a loud smack followed by an "ooh" or it being quieter all of a sudden. I've seen it happen twice in my short tenure as a metal musician, and it was very easy for me and my front man to make it to the person and whisk them to the back of the venue so they could get checked out.
Note: The band is not gonna stop playing if someone gets hurt, at least not in my experience. You can't wait for them to stop or for there to be a better time to grab the person, you have to do it immediately. And if you're in a stadium, you can't just scream "doctor!" You need to go down and find the paramedics and bring them back to the person.
5. Be an active fan
If you really liked someone's music at a local show, tell them. They'll appreciate the honest praise from a stranger more than anything their friends and family say. Talk to your local musicians after their show (once they get all of their stuff off the stage and put away) and you'll find that they're usually just cool interesting people. Most of the people that come to the local shows are friends of the band, so making a friend in the band could open you up socially to many other people. But if your favorite musician blows you off after their show, you might want to find a new favorite musician.
Good musicianship is no excuse for being a jerk, and being a diva is so much worse. I would avoid being friends with anyone who think their music is so superior that they are rude and condescending to other musicians. It's okay if your friend thinks their music is really good, it's okay if they've got a bit of a big head about it, but it's not okay for them to actively badmouth and belittle other people over petty things.
Also, buy local band merch. I can't stress that enough. A local musician's entire salary is what the venue pays them (which at some places, they don't) and what they can sell (which costs them hundreds of dollars to produce). The mark of a true fan is not just the one who listens to the music and likes it, it's who wears the shirts, hoodies, beanies, pins, and buttons of all their favorite bands. If you really really really enjoy a band, ask them if you can buy one of everything at their merch table or for a smaller bundle of their stuff. Most bands will give you a huge discount or give you several of one item for free because it's good for them, good for you, and it makes you both very happy.