Some good responses on here, Jack L's comes to mind. When you design a bridge there are myriad factors, whether it is road traffic or rail traffic but the fundamentals are the same. Engineering practice used to be to design at close to 2x expected load values, these days I hear it is much less, like 1.25. It could be they used to overdesign or they reduced the safety margin because of cost (my knowledge of this is not based on me being a CE, but I had members of my family who were).
As to why a bridge needs to be replaced and whether a rail bridge is 'built better' than a road bridge, a lot of the same factors come into play. Most bridges are built where they have an expected lifespan, the old Tappan Zee Bridge, built in the 1950's, was supposed to have a roughly 50 year lifespan; its replacement was finished several years ago. In theory with proper maintenance any bridge can last a long time, but that is the catch, proper maintenance. Given the cost of that kind of maintenance, and the vagaries if financing it (private or public, it doesn't matter), so what often happens is bridges aren't maintained well, they get patched, then they find later it is in bad shape and can't be patched and they finally have to replace it.
There are also things like vibration that damage bridges as well. One thing road bridges face is constant traffic, think of a major feeder highway to a city area. Obviously some train bridges face the same thing (there is a clunky old drawbridge over the Hackensack river in the Great Jersey Swamp aka "Meadowlands", the portal bridge, that once again today got stuck and train travel for Amtrak and NJ Transit into NY Penn is suspended for the day, has a lot of traffic), but I suspect some roads have the factor of constant traffic.
Road bridges and rail bridges have a common foe, salt. Highway bridges where they use salt are under assault every winter. Bridges, road or rail, that cross bodies of salt water, are exposed to salt water laden winds (the poor bridges across the East River face that in NYC, as well as road salt).
As far as buildings, they are designed to different parameters, their loads and stresses are much different than a bridge faces, though most of the physics is the same.
Some bridges are well designed, others are not. The Brooklyn Bridge happened to be way overdesigned, partially because that was the nature of the Roeblings (if you cut the 4 main cables of the Brooklyn Bridge, the roadway would not go down, the cables radiating from the towers (similar in principal to a cable stayed suspension bridge) would hold it up, albeit with a lot of sag). The Brooklyn bridge actually is interesting, you can say it is both types, it was designed (or rather, redesigned in the middle of building it) to handle standard passenger trains of the time, steam engines and all. The Brooklyn bridge is such that if they do routine maintenance, including replacing the cables every so often, would likely last forever as would many structures.