(Disclaimer: You can damage your vision and/or your camera by looking/aiming at the sun. Do not do that. No matter how convincing your “friend” says it, you will not win a free puppy.)
Capturing a sunset is an easy thing to do with a bit of understanding and some basic camera technique. The only real trick is understanding what it takes to get a correct exposure. Adding a nice foreground scores bonus points!
Exposure
The common factor in most good sunsets is a colorful sky, typically some flavor of orange or red transitioning to a deep blue. When your camera is pointed into the sun, the auto mode isn’t going to come up with the settings you want. It’s busy trying to get a balanced exposure and the result will be a washed out, white/grey sky. Not what you’re after. You need to tell your camera that you want an underexposed image (meaning you collect less light) in order to capture those colors. Start by underexposing by a full stop. (Consult your manual if you don’t know how to do this.) If the sun is still above the horizon you’ll need to underexpose the image even more.
Show up early, stay late.
Sometimes, the best colors will come while the sun is below the horizon. This is because the more atmosphere the light passes through, the more it will refract and reflect. Get familiar with the sunrise/sunset times in your area check the weather. Don’t be put off by clouds. Overcast isn’t good, but partly cloudy (especially high cirrus clouds) will make magic.
Foreground
A colorful sky is great, but an interesting foreground can add a lot to your image. Try to position yourself to catch interesting shapes in the sky. Backlit objects will show up as silhouettes, especially with your camera set to underexpose, so pay attention to the shape. Using a reflective surface such as a body of water or a glass-sided building can create interesting effects as well by spreading the amount of color throughout the frame.
Safety Issues (For You and Your Camera)
This is worth re-stating. Your mother was telling the truth about going blind (at least when she was telling you not to look at the sun.) The intense UV rays will damage all those sensitive eye parts forever.
Remember playing with a magnifying glass and figuring out you could set stuff on fire by focusing the sun’s energy into a spot? Your lens is a magnifying glass and you’re focusing the incoming light onto a small sensor. It may not burst into flames, but it could easily generate enough heat to damage your sensor or internal components. This hasn’t happened to any of my personal equipment, but I’ve had friends tell me they’ve melted a few.