The best gym routine depends entirely on what your fitness goals are and how much dedication you are willing to put forth to accomplish those goals. The most complete gym routine will include both muscle-building exercises as well as cardiovascular exercises, and cross training can add a bit of variety to break up the monotony. To plan the best gym routine for you, begin by outlining your fitness goals: decide if you want to build muscle, improve heart health, or improve overall health; figure out which parts of your body need more attention than others, then research exercises that will isolate those muscle groups.
A good way to structure your gym routine is to alternate days. If, for example, you do free weight lifting on Monday, do a session on the exercise bike on Tuesday. This allows the muscles you worked on Monday to recover sufficiently, so when you go to work those muscles again on Wednesday, they will be fresh and less prone to injury. Wednesday can either be another lifting day, or it can be a rest day; rest days are extremely important because they allow the body to recuperate from strenuous exercise.
Another way to structure a gym routine is to work certain muscle groups on certain days, then work another set of muscle groups on another day. One common way to isolate muscle groups is to work arms and shoulders one day, then lower back and legs another day. The third day is for rest, then the routine repeats. This forces you to work muscle groups that often work together, and on the next day, you work other muscles that do not often work with the first muscle groups. This way, the first muscle groups have an opportunity to rest.
A gym routine should be progressive; that is, when you start your routine, you will start small — smaller weights, fewer repetitions, fewer sets. As your body becomes stronger over the course of weeks or months, you will increase the weights, the amount of repetitions, and the amount of sets. This trains your body to expect more of a challenge as it grows and develops, and it constantly provides a challenge to your mind to keep the workout interesting.
When the workout inevitably does become too repetitive and boring, it's time for some cross training. Take a day away from the weight room and hit the racquetball court, or try swimming a few laps in the pool. This gives your body and mind a break from the routine while still working key muscle groups.