The best way is to choose another method. For your own sake, there is no guarantee that you would be killed instantly. Certainly, a train at speed would be a good candidate for a swift death, but there's every chance that you would merely be pulled under it and mangled.
Beyond that, however, thing of the people who would be affected. The driver of the train would potentially be traumatised by the experience, and a group of others would be left with the responsibility of cleaning up. Furthermore, when suicides happen, they cause chaos on the rail systems, with multiple trains held up and thousands of people discommoded.
We all here want to pass peacefully, and there is nothing peaceful about throwing oneself in front of a train. Please, choose another method.