This is a good question as, although in higher eukaroyotes codon usage does not necessarily correlate with translational efficiency, it does to a large extent in Escherichia coli (see e.g. Boël et al., 2016). The answer is not simple, but the following may contribute.
To optimize the strength of base pairing
Although in particular circumstances ‘wobble’ allows one tRNA to decode more than one codon (see diagram in my answer to Redundancy and the Generic Code) the strength of base pairing will be less for the wobble base-pair:
It has been suggested this would generally disfavour (and hence reduce the incidence of) the degenerate codon that needs to be decoded by wobble. (In some cases a wobble interaction might be an advantage if the first two codon bases were G or C, so that the hydrogen bonding was not too strong.)
To utilize the spectrum of tRNAs able to decode degenerate codons
Although wobble enables a reduction in the total number of tRNAs necessary to decode the 61 amino-acid codons, additional tRNAs often exist that one might regard as unnecessary. Furthermore, where three codons are decoded by a tRNA with a 5'-I (inosine), the other tRNA sometimes has a 5'-G (rather than A) and can hence decode two codons. This is illustrated by the E.coli tRNAs for threonine:
Thus, the relative abundance of these three Thr-tRNAs could determine the codon usage, and Dong et al., 1996 reported that this is the case.
To reflect the overall GC-content of the genome
If the genome of a prokaryotic organism has a particular base composition, because there is so little non-coding genomic DNA the mRNA will necessarily reflect that base composition in its codon usage. Your might ask why doesn’t the base-composition of the genome just reflect that of the synonymous codons, but there are actually strong pressures on the GC-content of prokaryotic and viral genomes. In some bacteria this may reflect needs for thermal stability, but in others it seems to be random drift (see e.g. Biology SE questions on GC-content of genomes).