The RER C is the standard way to arrive from Paris. Take it to Versailles Château Rive Gauche — the station is about a 10-minute walk from the palace entrance. Trains run every 15–30 minutes and the journey takes around 35 minutes from central Paris. A standard Paris transport ticket (Navigo or a single t+ ticket if you're within Zone 1–4) covers the journey.
Two other train lines also serve Versailles from Paris. The Transilien N reaches Versailles Chantiers, a larger station on the south side of town. The Transilien U (from La Défense) also goes to Versailles Chantiers. Neither puts you as close to the palace entrance as the RER C, but they're useful if you're coming from the west of Paris.
Coaches from Paris also run, usually from near the Eiffel Tower, aimed at tourists — they're slower than the RER but sometimes included in tour packages. By car from central Paris, the journey is 40–60 minutes depending on traffic, and parking near the palace is limited and expensive. Most people find the RER the simplest option by a wide margin.