When you're playing a game, you have to follow the rules. When you don't, someone might say:
Non vale (it doesn't count).
This comes from the verb valere (to have value, to be worth, to be valid).
Devi chiudere gli occhi però, se no non vale. Vai.
You have to close your eyes, though, otherwise it doesn't count. Go.
Captions 10-11, Sposami EP 2 - Part 20Play Caption
So in this case, the verb valere is used to mean something isn't valid, it doesn't count.
But we also use it when we talk about something being worth it. In English, we can say something is worth the trouble or simply "worth it." In Italian, we need to say the whole phrase:
Vale la pena (it's worth the trouble, it's worth it).
Insomma, la vita è una cosa meravigliosa e vale la pena viverla.
So, life is a marvelous thing and it is well worth living.
Captions 41-42, Amiche FilosofiePlay Caption
In the previous example, we have a subject: life. "Life is worth living." But we can also just say, "It's worth it." In this case, we use a sort of prop word, the particle ne.
We use ne when we comment on something being worth it or not. We know what we're talking about, but we don't need to repeat it. So we use ne.
Here's the negative version:
[Qualcosa] non vale la pena ([something] is not worth it).
Non ne vale la pena (it's not worth it).
We can say the same exact thing as a question: Here too, we'll use the particle ne if we don't include the subject (the thing that isn't worth it).
Vale la pena (is [something] worth it/worth the trouble)?
Ne vale la pena (is it worth it)?
The third way we use valere is to say something is applicable.
Questa regola vale soltanto per il singolare, quando io parlo della mia famiglia in singolare.
This rule applies only to the singular, when I talk about my family in the singular.
Captions 14-15, Corso di italiano con Daniela Aggettivi Possessivi - Part 5Play Caption
Vale la pena studiare l'italiano? Speriamo di sì!