Main-sequence binaries, contact binaries, and blue stragglers in globular clusters