Sweep a vertical line across segments, keep the ones it crosses in order by height, and test only neighbours: any intersection (CLRS), or every one (Bentley–Ottmann).
This interactive visualization needs JavaScript.