You are going to need to take the bus or train to Boston from New York or New Jersey (most buses only go from NYC, right?). You'll end up at South Station. From there, you can walk or take a cab (the subway is a bit roundabout to get from South Station to North Station as you take the Red Line and connect to either the Green or Orange which takes you to N. Station... the MBTA website can help) to North Station where the Salem train leaves from. I don't know where the bus picks up, but you can check the MBTA website for that info. From Boston there are local bus stops as well as a commuter rail stop that connects you to Salem. Salem is really close to Boston so it's not a bad bus or train ride from the city. Check the
MBTA website for more info on rail and bus service to Salem from Boston (use their trip planner feature to help you out).
Salem is VERY walkable and Halloween is one of the best times to visit. You can easily walk around town and there's plenty to see and do during the day/night there.
If you plan on staying for more than a day or two, I would consider staying in Boston and just commuting to Salem when you want to on Halloween. While Salem is wonderful, the walkable area isn't large enough to keep one entertained for more than a day or two. For a brief weekend... absolutely stay in Salem; any longer, base yourself in Boston.
*Edit* The bus to Salem looks to be pretty easy (I've never done it though). From South Station you need to walk just a few Blocks to the intersection of Otis Street and Summer Street (Summer is the busy street in front of South Station... follow it West about 4 blocks to reach the stop) and get on the 459 bus to Salem Depot. Here is the link to this Bus on the MBTA website:
http://mbta.com/schedules_and_maps/b...Redisplay+Time