How to get to Salamis
Nowhere in Greece is easier to reach, and no island journey involves less planning. Salamis is served by a car ferry that shuttles back and forth across the strait more or less continuously, so there is no timetable to work around and no ticket to book in advance. You go to the mainland quay, you get on the next boat, you are across in minutes. The complication, such as it is, sits entirely on the Athens side. Getting from the centre of the city out to the ferry quay takes longer than the sea crossing does, and the route runs through some fairly grim industrial suburbs. Budget your time for that leg rather than for the water. This is a day trip. Almost nobody stays overnight, and the ferry running late into the night means almost nobody needs to.
By ferry
The crossing you want is Perama to Paloukia. Perama sits on the western edge of the Piraeus conurbation, and the ferries across to Paloukia on Salamis run so frequently through the day that the service is effectively continuous: you turn up, you wait a few minutes, you board. The passage is well under half an hour and often feels shorter than that. The boats take cars, motorbikes and foot passengers alike, and tickets are bought at the quay, not online. The water you cross on this ferry is the battlefield. It is worth sitting outside for the few minutes it takes, because the whole point of the 480 BC fight was how narrow this channel is, and the crossing shows you that better than any museum could. Getting to Perama itself is the fiddly part: bus, or metro then bus, or a taxi. Allow well over the crossing time for it. There is a second, much less used crossing from Megara at the western end of the gulf, which lands on the north-west of the island. It is useful only if you are already out that way on the mainland; for anyone coming from Athens, Perama is the answer.
By plane
Salamis has no airport, and sitting where it does it would make no sense for it to have one. Athens International (ATH) is the gateway, on the far eastern side of the city. From there you cross Athens to reach Perama for the ferry, which realistically means metro plus bus, or a taxi if you are carrying luggage and short on patience. It is not a difficult journey, but it is a long way across a large city, so treat the airport-to-quay leg as the substantial part of the trip.
Other options
Local buses run from the ferry terminal at Paloukia towards Salamina town and out to the western villages, and they are perfectly usable for the main settlements. The service thins out noticeably in the evenings and at weekends, however, which is worth knowing before you plan a late return from the far side of the island. If you want the west coast, the beaches at Kanakia or Peristeria, or the monastery in the north-west, a car or a scooter makes the day far more practical. Since the ferry takes vehicles as a matter of course, bringing your own car over is straightforward and is what most Athenian visitors do. Taxis wait at Paloukia and are a reasonable fallback for a single trip across the island.