Approach at something close to a right angle. Easiest if the track is square to the road, of course. Only a little less easy if the track on the right-hand side (on US roads) is nearer than the left, so you can, in advance of your approach, swing out into the lane to achieve a square approach. Much trickier the other way -- you must wait for traffic behind to be clear so you can swing out into traffic as you cross.
Approach at "moderate" speed (maybe 10 mph). For a single track coast, for multiple tracks you likely must crank, but not too hard.
Quite important: Raise your butt off the seat and "suspend" your body on arms and legs. This isn't to save your butt (except maybe figuratively) but to assure that the bike doesn't bounce as it goes over the rails, and the wheels maintain firm contact.
As you approach, always study the rails and whatever is placed beside and between the rails. Often there will be a gap between ends of wood pieces, eg, and you don't want to get your wheel too near that gap. Very occasionally there will be a splice in the rails themselves, and that likewise needs to be avoided.
And, as one tour leader once told us, if the rails are wet, crawl across, dragging your bike behind you.