Is the "g" at the end of a word pronounced "ch" or not?
Sometimes when a word ends in "g" it's pronounced "ch" like "fertig" and sometimes it's not. Is it dialect specific or is there a reason behind this?
It is dialect specific. In Germany it tends to be pronounced as 'ch', especially in nothern Germany and in formal settings. In southern Germany, especially Bavaria, it is pronounced as 'g/k', especially in informal settings. In Austria it is always 'g/k'. And I have no idea about the Swiss pronunciation.
There is a region, called Westfalia in NRW, where mostly older and not so well educated people, pronounce almost every 'g' ending word like 'ch'.
"wo kommste wech?" -> "Where are you from" "Fluchhafen" -> "Flughafen" "Berch" -> "Berg" "Burch" -> "Burg" "Tach" -> "Tag"
That is quite funny (to me at least :P). Seeing „Wo kommste wech?“, my mind immediately puts it into Hochdeutsch as „Wo kommst du weg?“ which (as far as I know) doesn't make any sense; but might be an odd way of saying something like „Wovon rennst du?“ which has a pretty stark difference in meaning from „Wo kommst du her?“ :P
As far as I know, standard pronunciation is -k for final "g" except in the ending -ig, where standard pronunciation is -ich.
So "fertig" should be "fertich", but "Weg" should be "Wehk".
Up in the north where I'm from, final -g is pronounced -ch a lot more. ("Fluchzeuch")
The rule is that word ending in '-ig' are pronounced if 'ch' and all other cases with a 'g'. This is not a dialect, but rather the correct form, but we never have German pronunciation in school (in Germany), so a lot of people don't really pay attention or know rules.
Important notes: Teig was mentioned, which technically ends in -ig, but the rule does not apply in case of a diphthong.
This is only for the end of words. König is pronounced with ch, Königreich is not (well, the -reich is, but the König is not).