Tracks that span levels are like tracks that stay on one level, only made of ramps and more difficult to doublecheck due to the lack of visual display. Overly long example that might or might not make things click into place:
╞═════════╡
This track is all on the same level. The leftmost tile is E connection because it needs to be able to send a minecart to the tile east of it. The rightmost tile is W connection, to send the minecart west. The tiles between those two are EW connection, to allow the minecart to go either east or west as necessary.
╞▲
This track is a ramped track, and you can only see this bottom part. The leftmost tile is E connection, and then the track turns into ramp to give the minecart access to the level up, which you can't see because I'm displaying this as DF would and it only shows one level at a time. To make the connections easier to see, I'll drop the upramps down through the levels until they're on the same level as this bottom one, and turn them into flat track tiles so you can actually see the connections. Only the upramps matter here -- downramps are created naturally when an upramp is made underneath them, and you can't place a downramp yourself using in-game methods.
╞═════════╡
Voila!
To make the physical connection that you carve the track tiles into (or build the track tiles on if digging in soil), the dug route must be a. traversable by dwarves (if your miner gets stuck at the bottom of your ramp, a minecart isn't going to be able to navigate it any better...), and b. must have no tiles that are connected only by diagonals. Minecarts only move orthogonally.