The chromosomes in meiosis are homologous because they have the same sequence of genes as each other but they are not identical because the alleles of some of the genes will be different.
Homologous chromosomes pair up at an early stage of meiosis.
As non-sister chromatids are homologous but not identical, some alleles of the exchanged genes are likely to be different. Chromatids with new combinations of alleles are therefore produced.
Crossing over occurs at random positions anywhere along the chromosomes. At least one crossover occurs in each bivalent, but there is often more than one.
Each homologous pair of chromosomes forms a bivalent on the equator of the cell during first metaphase of meiosis.
The inheritance of one particular allele by an individual depends only on which way a bivalent happened to be facing when spindle microtubules were attached.
The number of possible combinations of chromosomes that a haploid cell produced by meiosis could contain as a consequence of the random orientation of bivalents is 2^n where n is the number of bivalents and also the haploid number for the species.
With two pairs of bivalents, as in the diagrams, there are four possible combinations, but most species have more chromosomes than this, so more possible outcomes.