Lots of questions. Unfortunately, my reference material is not accessible at the moment so my dates will be very approximate.
At Newport the Newport - Sunshine loop line junctioned from the main Melbourne line at the north end of the platforms. These days, the junction is the connection to the two Williamstown stabling sidings. Until the late '50s or '60s, the sidings off the loop line were served by pilots that originated in Newport Yard (the sidings on the Down side of the Williamstown line opposite the workshops; these days they have been built over). With the construction of the triangle at the northern end of the loop line (the direct connection between Tottenham Yard and Brooklyn), the goods working in the west was recast and the pilots were moved to originate from Tottenham Yard.
Tottenham Yard was for almost its entire history a complete white elephant. The original idea was to copy Enfield in Sydney; main line trains would arrive at Totty, be broken up, and then be tripped to their destination. As it was beyond the edge of Melbourne, land was cheap and a very expansive yard could be constructed that would allow cheap marshalling. Construction started around WWI and proceeded very spasmodically. Even when it was largely complete in the late '20s, little use was made of it. When the VR was looking at a new automated hump yard in the '60s, they looked again at Tottenham. They rejected using Tottenham in favour of rebuilding Melbourne Yard. The stated reason was that breaking up trains at Tottenham was a waste of time. Almost all the LCL and car load inwards goods traffic was for destinations in and around Melbourne yard (the receiving sheds, the Port of Melbourne). Hence, you would break up the inwards trains to produce a stream of smaller pilots pretty much all heading to Melbourne Yard. It was more efficient to break up the trains in Melbourne Yard and have short pilot runs to the traffic destinations. I'm sure this was the problem with Totty right from the start. As far as I know, Totty was really only used for a relatively short period in the late '60s and '70s. In that period the number of private sidings in the west exploded (particularly on the Newport - Sunshine loop line), and all the traffic to and from these sidings was concentrated at Tottenham yard.
The port at Williamstown was the original deep water port for Melbourne. Its importance declined after the construction of the Coode Canal and Victoria Dock in the late 19th century which allowed larger ships access to Melbourne. Until 1913 the piers at Port Melbourne and Williamstown were owned by the VR, while the piers and wharves on the Yarra/Maribrynong were owned by the Harbor Trust. The VR used Williamstown for the shipment of wheat; hence the large yard at Newport (for staging the wheat), and the sheds at Williamstown (for storing bagged wheat owned by the wheat agents). All this wheat traffic came down from the country to Melbourne Yard and then was tripped via Footscray/Newport to Williamstown. At this time there wasn't even a direct connection at Sunshine from the Bendigo line to the Newport - Sunshine loop line. This direct connection was put in 1920 and allowed train loads of wheat to be routed direct to Newport Yard where could be broken up for tripping to Williamstown. In 1913 ownership of all the piers/wharves in Melbourne were transferred to the Harbor Trust. This resulted in a huge barney between the VR and the Harbor Trust - the Trust refused to pay for maintenance of the sidings on its territory. I believe the court cases eventually went to the Privy Council. The result was very bad blood between the VR and the Harbor Trust. When bulk handling was mooted in the late '20s, there was to be two bulk export terminals, one at Williamstown, and one at North Geelong. The foundations of the terminal at Williamstown were constructed (and can be seen to this day behind the shipyard), but the terminal was never completed. Only the bulk terminal at North Geelong was constructed, and bulk grain exports all went there. I am quite sure that the VR were supporting the Port of Geelong to spite the Melbourne Harbor Trust. This left Williamstown serving the declining bagged grain trade, which died in the '50s and finished in the '60s. Williamstown, however, is still an active port. It is used for the import of bulk petrochemicals which are piped to the plants in the west.
The shipyard at Williamstown is dead. The dockyard was originally owned by the State government, then by the Harbor Trust, and in WWI was taken over by the Commonwealth as a naval dockyard. Except during WWII, naval construction and repair was shared between Cockatoo Island in Sydney and Williamstown in Melbourne. Little commercial construction was undertaken - the navy always had priority, and the cost plus naval contracts meant the naval dockyards found it difficult to compete with commercial dockyards. Towards the end of the 20th century the strategic stationing of the navy was changed, moving from a solely east coast base (Sydney) to a joint east/west coast base (Sydney/Perth). There were consequently too many dockyards on the east coast (Cockatoo Island, Garden Island, and Williamstown) which were too far from Perth. Cockatoo Island closed first, and Williamstown has recently been mothballed (and was, in recent years, only used for construction). I doubt any further naval construction will occur.