When it comes to sunrise/sunset shots, a significant part of it is indeed the luck of the draw. It is possible to get just the right kind of lighting...if you have the patience. Many of the best landscape photographers will, quite literally, spend days, even weeks simply waiting for the light they need/want/envision to occur. (A truly fantastic book about landscape photography and lighting is "Photography Essentials: Waiting for the Light" by David Noton. David notes several times in his book how he would spend days or weeks camped in front of a landscape he KNEW had potential, waiting for the right kind of lighting that he envisioned to occur. The results are usually nothing short of stunning.) If you have the time to spend, it is usually worth it, however most of us do not.
Getting a great sunset/sunrise shot when you can't wait around for days for it to occur requires a good visionary eye. You need to have the ability to "see" as the camera sees, and be able to envision what a particular vista may look like under better or even ideal lighting. That in turn requires that you find interesting vistas. A sad little fact that I am still trying to come to terms with myself is that a Landscape photographer spends far less time actually hauling out the camera and taking a photograph, than spending time driving around looking for interesting landscapes and trying to see them photographically. If you really want to get a stunning sunset, make sure you have the ideal setting, and can be there when there might be ideal lighting. The former can be controlled, the latter is up to nature.
Being at a good location when ideal light hits is often just luck, but you can be intelligent about choosing when you visit the location(s) you wish to photograph. A key factor in capturing good light is being prepared for it. You can't, for example, wait until sunrise to get a good shhot...you must be preemptive. Watch the weather forcast and be awake, geared up, caffeined-up, and ON SITE well before the sunrise hits. You will need time to find your perfect vantage point, set up your camera, finger on the cable release before sunrise hits. All too often, the best lighting doesn't last more than a few minutes, and sometimes a mere 30 seconds before that amazing beauty you set out to capture has faded. Sunsets can be easier in some sense, as you have existing light to find your viewpoint, set up, and focus.
Sunrises and sunsets are the type of scene that just SCREAMS for Graduated Neutral Density filters. Depending on where you are in relation to the sun, your landscape may simply be a black silhouette, and if that is what you want, then you are good to go. In the event that you want to capture landscape lit by ambient light, GND filters to balance out the contrast in your scene will be essential. Not only are GND filters useful for balancing out contrast, they can help bring out subtle details in the bright sky that are otherwise not visible (such as small wisps of cloud that blend easily into the amber sky.) The worst thing that can happen after spending a lot of time scouting out landscape vistas, envisioning how they may look under ideal lighting, and getting out there in time to capture the shot...is not having the tools to capture the beauty that occurs. Always pack some filtration, and a broad set of hard and soft GND filters, as well as some tinted graduated filters (such as coral or "sunset" grads), only enhance your chances of capturing those awesome sunsets.
Regarding knowing ahead of time when to be where, thats a difficult call. It depends on what you've envisioned, and what you hope to capture. As a general guideline, a solid sky, especially a solid blue sky, makes for a difficult "sunrise/sunset" composition. They do happen, but they are not the most interesting. An interesting sky is often a complex sky. Lighter cloud cover often makes for some of the best sky, as they capture the rays of light at a different angle than the rest of the sky or the landscape, adding alternative hues to an otherwise monochromatic orangeish/reddish sky. If you want to capture sun rays, haze, fog, mist, etc. are usually essential. Sometimes, capturing the sun a few minutes after it has set can produce some of the most amazing rays in a hazy sky that you've ever seen. Sunrises and sunsets can be captures at almost any time, in a variety of weather. Even in a thick storm, the moment when the sun creeps over the horizon, or the moment it crawls back over it, can produce some of the most amazing sunsets you've ever seen, as the whole underbelly of the storm can light up like fire. The only real time when the weather won't permit a great sunrise/sunset shot is when clouds quite literally cover the sky from horizon to horizon, leaving no room for sunlight to penetrate.
Planning and preparation aside, it is possible to find and capture a beautiful sunset on the spur of the moment. Only two days ago, while hiking around the (absolutely FREEZING) Indian Peaks Wilderness in the Colorado Rockies, I came across this vista:

Not the most stunning sunset vista ever captured. The foreground is very shaded, as the sun set behind the peaks, leaving little light to work with. The saving grace was the frozen (and rather intriguing) lake in the foreground that reflected the post-sunset glow in snow clouds from a brewing storm. Sometimes you just have to be in the right place at the right time, with your gear, to capture something amazing. If you wish to capture better sunsets, I wouldn't rely on the chancy nature of such lucky captures, and it is always better to know your vistas and be ready, camera on tripod, cable release in hand, waiting to snap a photo when good light occurs.