I always work legs in the off season. When I resume "real" riding, I'm amazed at how much easier the hills are!
Leg stuff:
Squats and lunges are good. Be sure your knee doesn't go over the tip of your toe. Have somebody show you - especially with squats - if you aren't sure. Leg extensions are good if your knees will allow it. Hamstring curls are great - our hamstrings are usually whimpy. Calf work is important too. Don't forget to stretch.
I work legs pretty heavily during the winter - i.e., twice a week, 10-12 reps & at least 3 sets each. I warm up squats with two warm up sets - 45 lbs for 15-20 reps and 65 lbs for 15 reps.
I don't take a lot of rest between leg exercises because I want my muscles to get used to doing heavy contractions without rest (like with rolling hills).
During the riding season, I work legs lightly about every 10 days. Same types of exercises, but much less weight and higher reps. I do legs when I know I'll be off the bike for a day or two.
Hope that helps.
Kim