The answer to this question is complicated, and the specifics of any particular case are going to be constrained by a variety of factors. For one, it is important to know that federal law preempts state law. If federal law claims that a train was going an appropriate speed, then typically no state law can successfully be used to argue that a train was going too fast. However, matters often get quite complicated in the relationship between the laws.
In general, it is safe to say that railroads have a responsibility to maintain a reasonably safe crossing environment, to sound their horn as they approach and pass, and to travel within the designated speed limits. Trains do have right-of-way at crossings, but the railroads themselves usually must maintain the crossings (this varies between crossings and jurisdictions, however). Overgrown vegetation or malfunctioning signals can prove to be fatal, and negligent railroads should carry the responsibility when they fail to do their part. Particularly an issue is dangerous crossings without proper warning equipment which, in spite of repeat accidents or complaints, the railroads find ways of ignoring. This is a tragic case of railroads ignoring their responsibility, and it is happening all the time.