My husband suggested that I write about accents today, so here goes. I'll try to dig a little deeper in than when I was trying to deal with dialects as a whole.
Anyone who hasn't read or seen Pygmalion by George Bernard Shaw should go out and do it if they're interested in accents. Henry Higgins in the first scene identifies the personal history of at least three total strangers just by listening to them talk. There are indeed some gifted people out there (and not just fictional ones like Henry Higgins) who can listen to the way you talk and thereby place not only where you're from, but where you grew up and how you were educated.
I'm not one of those people. I take pride in my ability to tell the difference between Australian, New Zealand, South African, and English accents and that's about it. Still, accents fascinate me.
Typically, accents will have what I'll call major and minor features. Major features are the ones that stick out and play a critical part in defining the accent, such as r-dropping and "a" sounding like "i" in Australian. Minor features are ones that form a part of the whole but usually go unnoticed, like subtle changes in vowel quality.
When a person like my husband moves to the US, having no particular desire to alter his accent but nonetheless possessing an ear for such things, the first thing that will change is the minor features. People with an ear for accent will change their speech unconsciously to match their surroundings. I am terrible with this, and in fact sometimes I'll even pick up my friends' speech quirks, like a dentalized "t," extra-rounded vowel or slightly lisped "s".
When a person moves to a new region and wants to assimilate to the accent, but has less of an ear for the subtleties of accent, you see the opposite - people who have deliberately changed the major features of their accent, but are nonetheless unable to change the more subtle aspects of their speech.
My husband has changed a few of his major features to reduce confusion, and has changed his minor features somewhat but not completely. The amusing (and sometimes irritating) result of this is that while Americans comment on his accent, his mother teases him for sounding "so American." Poor guy.
Of course, dialect is more than just accent, which is why it's so funny when Eliza Doolittle announces in her perfect accent "they done her in." Those of you who want to find my other dialect post can now search for it in the search bar!
When listening to foreign accents in your own language, it is generally easier to decipher what is meant when you have a sense of the person's native language. My husband, who never started learning Spanish until he came here (no reason to!) still struggles sometimes to feel fully in control of his comprehension of Spanish-flavored English. I found that once I started learning Japanese it became far, far easier to understand people with Japanese accents.
An accent is a system. It is not random. Not only does a person's native language make a systematic change in the pronunciation of a foreign one, but native accents are systematic as well. Take the English vowel system, for example. What we in America call "short i," as in "hit" is called a lax vowel, while "long e," as in "heat" is called a tense vowel, and then you have the diphthongs like "long i" that change their value over their length (a--->i = "i"). If you compare that to Australian vowels, it's actually pretty fascinating. In Australian English, all our lax vowels are pronounced as tense, and all our tense vowels as diphthongs, and all our diphthongs as more extreme diphthongs. It's like someone took the whole vowel system and shoved it towards the tense end of the spectrum. The relation between the vowels is pretty much the same, even though every individual sound value is different.
When dealing with accents in your fiction, don't forget that they give you a great opportunity to animate attitudes in your characters. Once you have a reason why the accent (dialect) diverges - isolation of a population geographically or socially, greater or lesser contact with speakers of another language etc. - then you can give your characters a judgment of it. Do they associate it with poverty? Arrogance? Ignorance? And don't forget this last question: Why? If you can give us a sense of where your characters' attitudes come from, then they will seem much more grounded and you can push them further than you would otherwise.