In this sentence, "with" does not mean "because of" or "as a result of." Let me rephrase the sentence so you can easily understand the meaning.
...and it must require skill and present an achievable challenge.
The goal of the activity must also be to succeed.
The "with" in this sentence just means "the goal being success" is an additional requirement of the activity. In other words, if you want to experience flow, the goal of the activity must be to succeed. For example, you cannot succeed if the activity is singing in the shower. There is no way to measure success in that instance. But you CAN succeed if the activity is performing a song for an audience. There will be positive or negative feedback, and if the audience enjoys your performance, then you succeeded.
So to make it very simple, the full meaning of the quote you provided is this.
If you want to experience flow:
- The activity has to be voluntary and enjoyable
- The activity must require skill
- You must be able to succeed at the activity. It must be possible.
- You must feel like you have control during the activty.
- You must received immediate feedback after the activity.
Other examples using "with the goal"
He went on StackExchange with the goal of improving his English.
She held a lecture on making friends, with the goal being for each participant to make one new friend that day.
I planned an sports day with the goal being to get more kids interested in playing sports.
She made an account on OkCupid with the goal of finding a boyfriend.