Switching from horizontal to vertical and/or keeping layers firmly together: this is done with bracing.
The image at the left shows how a vertical beam of 6x1 locks 4 layers of beams and one spacing plate layer together.
The distance between holes is 8mm in the vertical beam but the normal vertical pitch is 9.6mm in the stack of beams.
The distance between the two black pegs is 4x8mm = 32mm, between the top and bottom holes in a stack of four layers it is 3x9.6mm = 28.8mm but a plate is 3.2 so the grey spacer adds 3.2 to 28.8 to give exactly the 32mm needed to line up.
A useful table is in the diagram at the left. The regular stack at the top of the image shows that effectively the line-up can happen every second hole!
This can be done in the most regular manner by inserting two plates between layers of beams.
A stack that does not need bracing pegs every second hole can be "optimised" by replacing any three plates by a normal beam or brick. This is shown in the set of stacks below the horizontal beam.
Drag the diagram around, hold the option-key ("alt") to zoom and shift-click to return to the original view.