"Fine, thank you."
It's basically a verb (to thank). And we need the first person form here.
Dziękuje would be the third person singular form (he/she/it is thanking).
I have to admit, even native speakers sometimes struggle with that. Basically there are two types of "rz":
Type 1) Static rz, which developped from a soft (palatalised) Old Slavic r. There's no other way than to just remember how those words are spelled. If you speak an East Slavic language, there's a trick: Look for a cognate and check whether it has a rolled r in it. If it does, it's a rz in 99% of cases.
Type 2) Dynamic rz. Now that's easy. In the case of adverbs, check the corresponding adjective (dobry). Remember the rule: r + ie = rze. The ie-suffix is added to form the adverb, thus dobr (stem) + [ie] become dobrze. The same goes for nouns: Górze is the locative/dative form of góra. [-ie] is the suffix that creates the rz according to the aforementioned rule.