What chooses when dakuten gets added to a kanji?

If you’re on desktop there’s a great userscript that adds rendaku rules for that word in Lesson and Review format.