The description of the pairing system, and the algorithms required, are in the FIDE Handbook: handbook.fide.com/chapter/C0403
B2 covers the principle of splitting a scoregroup into S1 and S2; i.e. top half and bottom half. If you have 2n players in any given scoregroup, then the group pairings should be 1 v n+1, n+2 v 2, 3 v n+3 ... until you get to n and 2n. If you start with 2n+1 players in Round 1, then you pair as described in the previous sentence, and 2n+1 has the pairing-allocated bye.
The guidelines for programmers produced by FIDE may be useful to you: pairings.fide.com/images/stories/downloads/appendix_p_approved.pdf
@thibault
B2 covers the principle of splitting a scoregroup into S1 and S2; i.e. top half and bottom half. If you have 2n players in any given scoregroup, then the group pairings should be 1 v n+1, n+2 v 2, 3 v n+3 ... until you get to n and 2n. If you start with 2n+1 players in Round 1, then you pair as described in the previous sentence, and 2n+1 has the pairing-allocated bye.
The guidelines for programmers produced by FIDE may be useful to you: pairings.fide.com/images/stories/downloads/appendix_p_approved.pdf
@thibault