First, you must be able to do an ollie, and being able to do a 180 ollie would be an advantage.
Step1
Approach the rail at a moderate speed, but just fast enough so that you coming up to the rail fast.
Step2
Once you reach the rail, pop a 90 degree ollie onto the rail so that the centre of your board is centered in the middle of the rail. By this point, you should be sliding down the rail.
Step3
When you are sliding, each foot should be on each end of the board. You have to keep you balance at this point because if you don't....
Step4
Once you reach the end of the rail, pop another 90 degrees ollie off the rail in the opposite direction that you popped to get on the rail. (example: If you popped to the right to get on the rail, you wanna pop to the left to get off).
Step5
roll away clean.
Tips & Warnings
If your board is stopping at the middle of the rail when you are sliding, that means you didn't get enough speed when approaching the rail.