I like to approach maybe a board's width or so to the side of the rail and just before the takeoff i make a quick setup turn and point myself a narrow angle maybe 20-30 degrees towards the feature, pop off the lip, don't look at where you're want to land look at where you're going to dismount the rail (so, at the end or beyond), there's a tiny adjustment in the air, to keep yourself from continuing on that angled approach (and hence sliding off the rail to the side).
Commit commit and more commit. As soon as you olly on, look towards the end of the rail and don't try correct any mistakes. If you slide off, wait until you aren't touching the rail and then secure your landing. Keep your weight centered and DON'T use edges!
Yep as others have said look to the end of the feature (or even beyond it) this keeps you upright and balanced, as opposed to what might be your instinct to look down between your feet to make sure you're locking on, but you'll *feel* whether you locked or not.
If you don't *feel* it, and you'll know what this feels like if you're already comfortable on rails, you're off-center or off balance or whatever there's like a 1% chance you'll be able to correct it and about a 99% chance you'll end up eating shit if you try, so it's best to just let it roll and dismount gracefully.