"Országosan ötezer nézőt kell elérni ahhoz, hogy..."
"[Sentence 1 <with kell, szükséges, etc.>] ahhoz, hogy [Sentence 2 <in the imperative>]."
This is a conjunctive set phrase and it means:
"In order to [Sentence 2 <in the infinitive>], [Sentence 1 <with have to, is needed/necessary, etc.>]."
This is how it works. You take two basic sentences:
If you explain why "(in order) to + infinitive"
represents the objective
or the goal
or the purpose
in a compound sentence in English, I'll explain why "ahhoz, hogy"
represents the same in Hungarian.
There must be a reason as both to
signify a direction
; in this case it is a figurative direction connecting the condition
with/to the purpose
[S1] Száz forint kell. ("100 forints are needed." <indicative>)
[S2] Veszel egy gömb fagyit. ("You buy one scoop/ball of icecream." <indicative>)
[S1] will be the condition, [S2] will be the objective/purpose.
We'll express this idea:
"For you to buy one scoop/ball of ice cream, 100 forints are/will be needed."
"100 forints are/will be needed for you to buy one scoop/ball of ice cream."
(Which simply means: "You'll need 100 forints to buy one scoop/ball of ice cream.")
So we use this structure:
[S1 <indicative>] ahhoz, hogy [S2 <imperative>].
"Száz forint kell ahhoz, hogy vegyél egy gömb fagyit."
A similar sentence:
[S1] "Országosan ötezer nézőt kell elérni. <indicative>"
[S2] "A sorozatot folytatják. <indicative>"
"Országosan ötezer nézőt kell elérni ahhoz, hogy a sorozatot folytassák."
"Five thousand viewers must be reached nationally in order for the series to be continued."
(Context: when they broadcast three pilot episodes on TV or when they pur a show on stage, they measure the number of people who watch them, and if the number is high enough, the series or the show will continue; if not, it will stop.)In this case (an in many cases) the imperative (folytatják => folytassák; veszel => vegyél etc.) works very similarly to the subjuntivo in Spanish and to the infinitive of purpose in English.
Does this help?