As said it varies. Some couples do choreography, some do complete freestyle. Our Latin and rhythm routines are choreographed because we don't need to be concerned about floor craft as much (except in samba), though we will adjust for lead/follow when needed. Our smooth routine is choreographed though we know it will change on the fly for floorcraft reasons. Our standard uses amalgamations but we do them as lead/follow based on spacing.
As for how you match to unknown music, most competitions used strict tempo arrangements, meaning that the bulk of the music (most everything after the introduction) is going to keep the exact same speed (tempo) and phrasing. For most music, particularly at the lower levels, this means the music occurs in phrases of eight measures with a minor highlight in the fourth measure and a major highlight in the eighth. Even though I don't know what song will be played for our smooth waltz, I start with forward progressive twinkles that transition to back progressive twinkles on the fourth measure (to match the minor highlight) and end in an inside underarm turn on the eighth measure (matching the major highlight). We can do this for all the dances.
At higher levels the strict tempo music played often uses different phrasing, inserting an extra measure or two during bridges between phrases. The best dancers know how to incorporate those on the fly, thus keeping an element of lead-follow in their dancing despite doing routines.