There are two options for trains from New York City to the Hamptons. The most commonly used is the Long Island Railroad, which operates regular and express trains along the Montauk Branch. The regular train, called Hamptons Coach Service, makes all station stops between the city and the Hamptons, and so is a longer ride -- it's two hours to Westhampton and three to Montauk. All Long Island Railroad trains have two levels with air conditioning and ergonomic seating. The other option is The Cannonball, which only operates in the summer. This train runs an express service that bullets to Westhampton in an hour and 40 minutes and to Montauk in just over two hours. These trains have in-seat beverage and snack service similar to an airplane.
To take the Long Island Railroad from New York City, catch a train at Penn Station and connect to a Montauk Branch train at the Jamaica LIRR station. Other trains connect at Jamaica from the Atlantic Terminal in Brooklyn and the Long Island City station. Trains stop at Westhampton, Hampton Bays, Southampton, Bridgehampton, East Hampton, Amagansett and Montauk. If you're taking The Cannonball, pick up the train at Penn Station. This express train goes to the Hamptons on Friday evenings only, and returns to Penn Station on Sunday evenings only.
The Cannonball has leaves Penn Station only on Friday evenings in summer, but the LIRR runs year-round, with increased frequency in summer. Two LIRR trains leave the city each morning, one in the afternoon and two later in the evening. If you're taking the morning train, you must change trains in Speonk, which is the last station on Long Island before the Hamptons. Service in the off season is more spotty and indirect; you can expect a few transfers to other trains along the route.
Trains to the Hamptons, especially in summer, are a hot commodity. You should prepare to get to the station well in advance of your train -- a last minute arrival could mean missing the train. Despite extra trains to accommodate the influx of passengers in summer, ticket lines can take a half-hour to get through on Friday afternoons. You can purchase advance tickets through the Metro Transit Authority, which sells 10-trip booklets valid for six months and transferable to other people. Prices for trains vary; peak travel, which starts at 4 p.m. on weekdays, is more expensive than off-peak travel.