I figured out how to get in a minecart on a minecart track, but I can't figure out how to dismount from it. There doesn't seem to be anything in the controls for it.
I did a quick search, and found that somebody had asked the same question on Reddit not 10 hours ago.
There have been three solutions offered, though I can not personally confirm if they work.
The 'R' Key is the suggested key binding to exit the cart. If this is, in fact, the default key binding, any custom key mapping could make this unreliable. That said, it is the only suggestion that has up votes, and others have said the same, so I would expect this to be reliable.
Grappling Hook is a method one user suggests. I assume they ran in to the same issue, and resolved that using the grappling hook was a more efficient way of getting out then looking up the correct function.
"Cancelling the Buff" seems like the most reliable way, in that it does not require a particular item, or presume any default key mapping. Simply look to the top-left of the screen, where you should see a list of your active buffs and de-buffs. One of the active buffs is the mine cart. Right-click on it to cancel the buff, and exit the mine cart.
The minecart acts as a limited mount, so you can get out of it the same way you would dismount (I believe the default is R). If you have a grappling hook, the act of grappling will also cause you to exit the cart.
In versions earlier than 1.3, using an item (like singing a sword or placing a block) causes you to exit the minecart. The other answers work post-1.3.