Although part of the mainland, you can only reach the Railay area by boat. There are two areas on the mainland where you can get regular boats, which will take you to two areas in Railay.
To the east, and thus closest to Krabi airport and town, is the dock at Nammao bay (Ao Nammao). Boats from here run to Railay East, at just about any time of day. "Shared" boats depart when full for a cost of 50 Baht (1.30 USD) per person. If you're in a hurry, you can pay more to 'rent' the entire boat. Figure on paying at least 200 Baht (5.19 USD) for a personal trip.
To the west, boats leave from Phranang and Noppharat Thar Bays for Railay West. Prices are similar to the boats from Nammao Bay, but, boats from the west only operate during the daylight hours. If you're staying in Railay and need to get there after dark, you must make your way to Nammao Bay.
Regardless of where you depart from, the trip to Railay only takes around 15 minutes.
Worth noting: There are no docks at Railay. Getting from a boat to dry land will almost certainly require you to get your feet wet. A few hotels on Railay East have some tractor contraptions to get you and your luggage from the boat to the hotel, but these are not always available. Dress appropriately when going to and from Railay.