From Wikivoyage:
By Train
There are three different train stations in Versailles: Versailles Rive Gauche, Versailles Rive Droite and Versailles Chantiers. The Versailles Rive Gauche station is the one closest to the Palace (5 minute walk), though the other two stations are not all that much further away (about 15 minute walk).
From Paris: the most straightforward (and often fastest) route it the RER C5 line, direction Versailles Rive Gauche (train called VICK), get off at Versailles Rive Gauche station.
Be careful not to get off at Viroflay Rive Gauche! The name looks somewhat the same, but it is not the right station! The RER C7, direction Saint-Quentin-en-Yvelines, stops at Versailles Chantiers (train called SARA or SLOM). Do not take RER C4 terminating at Versailles-Chantiers (train called CIME) as this takes a long tour of the southern suburbs of Paris before reaching Versailles. This train is very slow but Versailles Rive Gauche is the closest station to the Palace.
From Paris Montparnasse: Take Transilien N to Versailles Chantiers. A rare direct train will bring you to Versailles in 12 minutes, but the walk is not very nice from that station. Most trains call at Viroflay Rive Gauche where you can change for a C line train to Versailles Rive Gauche.
From Paris Saint Lazare: Take Transilien L to Versailles Rive Droite. You will reach Versailles in 33 minutes, with the opportunity to see (or visit) La Defense on the way. The walk from that station can be very pleasant.
By bus
Route 171 travels between Pont de Sèvres (at the end of Métro line 9) to Versailles (right in front of the palace). The bus journey from the station to the château takes approximately 30 min. A ticket t+ (Paris metro/bus ticket) is valid for the bus journey (but you can't use the same ticket for the bus and for the metro).
By bike
It's a nice bike ride from Paris via Bois de Bologne and Parc St Cloud.
For the Château, it's open daily except Mondays and 1st January, 1st May and 25 December. Check temporary closures as some parts of the palace are occasionally closed for renovation or for official purposes (the Château hosts some visits of foreign dignitaries as well as joint meetings of the two French assemblies).
The opening times for the palace are 9AM-5:30PM November-March, 9AM-6:30PM April-October. The grounds open earlier and close later.
One-Day Pass (all inclusive) Apr-Oct: €20 weekdays, €25 weekends; Nov-Mar €16; under-18s free. Château-only tickets also available : €13.50, museum pass holders and under-18s free. Marie-Antoinette's Estate and Grand Trianon-only tickets : Apr-Oct €9, Nov-Mar €5 ; under-18s free. The Grandes Eaux Musicales, week-ends and bank holidays only, Apr-Oct €8, under-18s €6, under-10s free.
The transportation is very easy and safe - there are a LOT of tourists who will be doing a similar trip. Keep an eye out for pick-pockets and never leave your stuff unattended.
For more information, have a good read of the Wikivoyage webpage on Versailles.