This is probably the most important rule. Whenever riding in a group, you should be riding two by two, side by side (with only a few centimeters between you, you should not be able to fit a bus between you and rider beside you) and be perfectly handlebar to handlebar.
Do not at any time sprint ahead and disrupt the flow. Even if there is a corner coming up, stay side by side and go through the corner like a well-oiled machine. Riding with your bars ahead of the rider beside you is called "half-wheeling" and is a major faux pas.
It's up to you to keep up with the speed of the slower rider next to you. Try to keep to the side of the road. There is no need to take over the whole lane and annoy car drivers.
As with everything, there is an exception to the rule. If there is an uneven number of riders in the group and you don't have anyone to ride alongside, you should place yourself in between the two riders ahead of you, with your front wheel between their two rear wheels.
This allows the riders behind you to remain bar to bar and to keep the group tightly together. The riders behind you should ride with their front wheels on either side of your rear wheel. It's not acceptable to sit directly behind the rider ahead of you and leave a gap to your side.
It might seem that riding between the wheels of the riders preceding you is unsafe, but if everyone is riding bar to bar as they should be, you are guaranteed the space of a handlebar's width within which to move, which should be ample. So even if the two riders ahead of you knock into each other, you should have plenty of space. This is a pretty safe place to be.