I am a UK citizen and will be flying to Toronto in September and spending 2 weeks in Canada before traveling by train from Montreal to New York for 4 days and then flying back to the UK form New York. Will I need to apply for an ESTA and a I-94 for my trip to the US?
To enter the US by land, you don't need ESTA, but you do need an I-94. You can get one at the border, but your trip will go more smoothly if you get it in advance. For reasons I do not understand, you can only do that if you have ESTA authorization.
One source for this assertion is Citizen of Visa Waiver Country, wants to drive into U.S. from Canada or Mexico, or arrive at a port of call in the U.S. by cruise ship, a webpage of US Customs and Border Protection (CBP):
If I am in Canada or Mexico and want to drive to the U.S., do I need to apply for ESTA?
If you are a citizen of a country that participates in the Visa Waiver Program (VWP), and you enter the U.S. by land from Mexico or Canada, you are only required to complete the paper I-94W form at the land border crossing. ESTA is currently required for air and cruise ship travel only.
(However, as noted at the I-94 site linked above, instead of completing the paper form at the border, you may apply in advance online.)
Note that there is currently a proposed regulation at the "final rule stage" to extend the requirement for ESTA authorization to travelers arriving at land borders. It appears that this is expected to go into effect in October 2019, but it could be the reason for the requirement to have active ESTA authorization in order to apply for an advance I-94.
As an aside, I've recently seen some carelessly worded copy on the website of some airline or other that said that you need a valid ESTA to fly out of the US. This is completely untrue. ESTA authorization can even expire on the date when you enter the country. See, for example Does my ESTA need to be valid for my entire stay in the United States? from CBP:
Do travelers need to update their travel authorization if it will expire before they depart from the United States?
No, An ESTA is only required to be valid on the day you enter the United States. The ESTA does not need to be valid for the entire time a traveler is in the U.S. If the ESTA expires while you are in the U.S., it will not affect your admissibility or the amount of time you are permitted to remain in the U.S.
If an ESTA travel authorization expires before the traveler leaves the United States, the traveler is not required to apply for another. The traveler will need to apply for a new travel authorization through ESTA, however, for future travel.