I can confirm electrobadger's main results. I used CheatEngine to look into the game. The minecart has a variable for speed. Speed is measured in tiles/100000 per tick, so a speed of one hundred thousand means one tile per tick. Since the game internals use these units, this is what I will use.
The maximum speed is 270,000. You can hit it exactly by going down enough ramps.
Every tick, your speed goes down by some constant based on what tile you are currently on.
Distances: if you push a cart, you start in the MIDDLE of the next tile, not the far end of it, so it takes half as much for you to get past it. Normally, once you've accumulated 100000 distance units, you move to the next tile. This DOES carry over to the next tile.
Tile: friction
Tracks: 10
ground/floor: 200
unusable ramp: 10
going up a ramp: 4910
going down a ramp: -4890
A dwarven push starts the minecart at 19990 in the middle of the next tile, in that the first nonzero speed that the cart has is 19990.
Corner tracks are 10, but on leaving the corner tile, you get penalized another 1000 (in addition to the friction of the next tile).
Track stops:
highest: 50000
high: 10000
medium: 500
low: 50
lowest: 10
Empty space is entirely frictionless.
You CAN phase through walls if both flying and moving faster than one tile per tick, but you stop immediately on the other side. Cue everyone's secret fortress entrances behind walls.
---
WATER
Take the water level (out of seven), then subtract one, then multiply by 100. Add this to the tile's normal friction to get the friction of the tile in that much water.
MAGMA
Take the magma level out of seven, then subtract one, the multiply by 500. Add this to the tile's normal friction to get the friction of the tile in that much magma.
If the cart at least 6/7 deep, and it has room, it will take 2/7 into itself.
I'm (finally) tired of this. I'll put it in a more digestible format on the wiki later.
edit: Different water/magma levels have different maximum speeds. Research for later.