You can get to Montauk via car, train (LIRR), bus (Hampton Jitney), and ferry.
TRAIN: Take the Long Island Railroad (LIRR) from Penn Station to the last stop, Montauk. There is a transfer in Jamacia. Note it is around a 3 hour train ride. See here for more info: http://lirr42.mta.info/ BUS: Take the Hampton Jitney (Bus) from multiple stops in NYC to the South Fork getting off on the last stop, Montauk. We highly suggest booking tickets online ahead of time. Note it is about a 3 hour bus ride from NYC. See here for more info: https://www.hamptonjitney.com/
There are two ferry options if you are driving from CT. New London ferry to the North Fork: There is a ferry available from New London to Orient Point on the North Fork of Long Island, which can save some driving time by cutting across the Long Island Sound (instead of driving all the way into NYC, and then out to Montauk). Ferry from Bridgeport to Port Jefferson: There is also a ferry you can take from Bridgeport to Port Jefferson in Long Island.