Wishing someone "good luck" in German often goes one of two ways--either "Viel Glück!" or "Viel Erfolg!" Which one you use depends on what you want to say.
If you'd like to wish some one "good luck," then go with "Viel Glück!" It really is like wishing them luck--because you're unsure how the result may turn out. However, just like in English, it's also possible to say, sarcastically, "Good luck with that!" Then you also use "Viel Glück!" and if you want to add extra emphasis to the fact that you don't think it's going to go well, then...use your sarcastic face. (Be prepared for a reaction because those Germans...they are honest!)
Now let's look at situations when you are fairly certain that things will go well--or you are hopeful that things will go well:
- your partner is going for a job interview
- your co-worker has a big, important presentation to give and she has been working hard getting prepared
- your child has a test at school
These are all situations in which we all really want things to go well. Then you use "Viel Erfolg," literally "Lots of success!" Isn't that a wonderful way to wish someone well--"I wish you much success!"
Maybe you also want to follow-up with a comment to provide extra encouragement; you could also say "Du schaffst das!" Literally--you will get it done!
Or perhaps you have a good relationship with your co-worker, then you can stop by the bakery or Süßwarenladen on your way to work and pick up a Glücksschweinchen made of marzipan--it's the perfect German Glücksbringer. Here at the left you can see two Glücksschweinchen.
How to find good luck in Germany
If you need some luck and you see a Schornsteinfeger (a chimney sweep) be sure to greet them and then touch their left shoulder--it will be easy to notice, as the shoulder of the jacket will be worn from so many people touching it. In Germany, Schornsteinfeger are considered good luck and they are also often pictured with a Glücksklee (4-leaf clover) or with a Marienkäfer (lady bug).
Ich wish you viel Glück und viel Erfolg with your German learning!