I should note that this is written with an eye towards fictitious languages, rather than imitating the accents that real people have, though I'd welcome any insights on that. One caveat -- my degree is in literature, and I'm not a grammarian. I may've gotten some of my grammar terms wrong -- if you notice anything that sounds off, please let me know!
What really helps in creating a consistent "foreign accent" isn't what I've learned of English, but what I've learned about Spanish and German, and to a much lesser extent, other languages. Because the key thing is understanding what the speaker's native language is like, how it differs from English, and what parts would be most likely to trip the speaker up.
Different languages have different sounds that are common and uncommon to them. For example, Spanish only has five vowel sounds: "ah", "ey", "ee", "oh" and "oo". So a Spanish speaker is likely to have a hard time pronouncing words that use, say the "uh" sound. German doesn't have a "w" sound, which is why Germans are stereotypically shown as saying things like "Ve have vays of making you talk".
While this is not unrealistic, it usually looks overdone and gives that Hollywood-backlot-Indian effect if you do very much of it in text. Not to mention that your dialogue can become just plain hard to read. But this is one guideline you can bear in mind when you're trying to make up words for a foreign language, and you want them all to have the same sort of "feel" to them.
Another example is letter-combinations: Laosian is a vowel-rich language and very rarely uses double consonants. Their words don't make sounds like "pl" or "sp". (They also don't have sounds like "ch" or "sh", which is why almost everyone one calls Rasheeka "Raseeka".) By contrast, Neyemen strings together consonants with almost no vowel sound between them, creating words like "yejsk". As I recall, "sj" and "js" are very common sounds in Neyemen.
If you do play with sounds, I suggest you give a twist to relatively rare sounds. For example, a character's native language might not have a "qu" sound, and so he says things like "quick" as "kick" or "wick". Or "z" sounds become "s". Being consistent with this can be tricky, because english spelling is so wonky. If a character pronounces "zoo" like "sue" he'll also pronounce "was" like "whas", or maybe, "whus". You can also try describing the accent in text following the statement, rather than typing it funny. for example:
"Thank you, Thomas." Rachel spoke with a slight accent, making the "o" in Thomas sound long, and placing more stress on the second syllable.
I'm not entirely wild on that, as it gets awfully wordy fast. If you go that route, it's best to emphasize "*slight* accent" and only mention it very rarely.
Playing with grammar seems to work better than playing with sounds, over all. There are LOTS of things that can go wrong with grammar!
1) Conjugation: This is a huge pain in any language that has it, including English, which has the infintive ("to run"), a past tense (I ran) a past imperfect ("I was running") a past perfect ("I had ran") a present tense ("I run") a present imperfect ("I am running") a present perfect ("I had run"), a future tense ("I will run"), a conditional tense ("I would run"), an imperative ("Run!") and probably some others that I'm forgetting. This isn't even to mention the different conjugations depending on subject. English mostly just has two forms, one third person singular (("he/she it runs") and one everyone else ("I/you/we/they run"). But many languages have many different conjugative forms, some for subject types English doesn't even use any more. Spanish has a different endings for first person singular (I), second person informal (what used to be "thee" in English), third person and second person formal (he/she/you), first person (we), second person informal plural (English never had one of these) and third person plural and second person formal (they. English doesn't, strictly speaking, have a seperate second person plural -- it's still "you" -- but "y'all" or "youse" are used regionally as a second personal plural. If you're faking a Southern accent, never use "y'all" to refer to just one person.)
Anyway, despite all the complexity, you don't actually need conjugation at all to get a good idea of what people are saying. I knew a man who lived in Mexico for a year and habitually used the infinitive form for everything. The speaker sounds kinda dumb like this, but everyone can still understand him. In English, we have our funny two-word infinitive (to + verb) so one would be unlikely to go my friend's route in using it. (Most European languages have a single word infinitive form: "hablar" = "to speak"). More likely, they'd just use the verb alone. "Yesterday, I go to a party where I hope I meet a girl who marry me, but I not meet anyone new."
In the case of the yejsk, he always used the participle form of all verbs: "Seeing I not hurting you?" This is probably because his native tongue used the participle form of verbs more often than any other. It's very likely that the yejsk knew he wasn't using correct conjugations, but that he either didn't know what the right conjugations were, or he wasn't sure enough of them to bother.
At a less extreme end, you can have characters have trouble with certain conjugations but not others, particularly multiple word conjugations in less-common tenses, like, say, the conditional past perfect. So instead of saying "I would have reached the finish line, but she stopped me", an ESL (English as a Second Language) speaker might say "I would reached the finish line, but she stopped me."
2) Articles: In English, the articles are "a", "the", and "some". Many other languages have gendered articles -- that is, there's one gender of article for "the mother" (la madre) and another gender for "the father" ("el padre"). They may also have plural articles -- "the mothers" = "las madres", "a mother" = "una madres", "some mothers" = "unas madres". In languages with gendered articles, tat usually means *every noun* has a gender. In spanish, socks and radios and videotapes and everything else is gendered.
Alternatively, the language might not have articles at all, since, frankly, what do you need 'em for? "I went to the party to meet the girl" conveys only slightly more meaning than "I went to party to meet girl".
So this is an area ripe for mistakes. The yejsk hardly ever used articles. That doesn't mean Neyemen didn't have articles -- it may have had the equivalent, but not used it as often as English does. The yejsk used "the" when he was talking about something important: "I giving you eyntzomo, yskar orimia. Eyntzomo, spirit of the warrior. Spirit of the wise man" but not the rest of the time. So he may have been trained to think of articles as only used for emphasis, not habitually.
If the speaker's native language has gendered nouns, one common mistake is to use gendered pronouns when talking about inanimate objects. This leads to the stereotypical Italian accent: "She is a beautiful day, no?" But it's a likely slip to make. At the extreme end, someone for whom English is a second language might never use the gender-neutral pronoun "it" at all.
3) Pronoun usage: Some languages seldom use pronouns. Sometimes, it's because the conjugation of the verb already includes that information ("hablo" is the first person conjugation for the verb "to speak", so it can't mean anything except "I speak" -- "Yo hablo" is redundant.) In such cases, the pronoun may only be used for emphasis: "Yo hablo" means "*I* speak". In other languages, it's just the way people talk. If I recall correctly, Japanese people often refer to everyone, including themselves, in the third person, by name. So that while in English it's natural to say "I'll explain it to you", in Japanese the natural way for me to say it would be "Rowan will explain it to Brenna".
As an accent, this might manifest by having the speakers never use the second person -- they'll say "her" or use your name, even when addressing you directly. (This might be one way for them to show respect, too -- they might consider addressing you as "you" to be too intimate).
Or an ESL speaker might habtually leave off subject pronouns from their sentences -- even in English, if you ask me "When is she coming?" the answer, "Is coming at noon" is perfectly intelligible, though grammatically incorrect.
Another thing to confuse: subject/direct object/indirect object/possessive pronouns can easily be mixed up. Instead of "I asked her to get my ball from him" you might get "I asked she to get I ball from he". Or maybe they'll get it partly but not all the way right: "I asked she to get my ball from him". This might indicate their native language has different pronoun rules -- maybe in their tongue, subject and direct object pronouns are the same, but there's a different set for possessives and indirect objects. (By contrast, in English, direct and indirect object pronouns are the same -- but that wouldn't necessarily be the case in another language.) Or it might just be that there's a lot to remember and the speaker can't recall which pronoun goes where and goofed.
A language that doesn't have as many different pronoun forms as English does is more likely to generate speakers who get them confused: "Me talk to she".
4) Word order: English sentences have a certain general word order, though it can certainly vary a lot. For example: the subject usually comes before the verb ("I asked"), direct objects from after the verb ("asked her", indirect objects come after the preposition ("from him"). Possessive pronouns come before the noun ("my ball") as do adjectives ("red ball").
Any of these could follow different rules in another language. As I recall, the subject of a sentence in German comes at the end, which might lead to sentences like "Asked her to get my ball from him I." >.< . Another common language stereotype is placing the adjective after the noun: "It is the day beautiful!" if the native speaker's language has no formal word order, you might get the sentence totally jumbled up: "Her asked my ball to get I him from". But that quickly becomes incomprehensible. Yoda-speak scrambles the word order, usually putting the verb near the beginning: "Try not. Do or do not. There is no try." This is another consistent trick you can use in speech that'll still be comprehensible. "Learning much, you are. Become wise, you will. Speaking with correct grammar, maybe not."
5) Pluralization: Not all languages have plurals, and an ESL speaker might forget to pluralize.
Learning the rules of grammar is one struggle. Learning all the exceptions to correct grammar in a language like English is much, much worse. An ESL speaker is a likely to use an incorrect form that would follow the typical rules, rather than using the correct form that is an exception to them. For example, in "Prophecy" one of the characters never conjugates the verb "to be", except to the participle form ("being"). Because EVERYTHING ELSE about that verb is an exception. By the rules of English conjugation, present tense of "to be" should be: "I be/you be/he bees/we be/they be" Instead it's "I am/you are/he is/we are/they are". What the heck? It's the only English verb i can think of where the present tense first person is different from the present tense second and plurals. And the past tense is just as bad: "I was/you were/he was/we were/they were/". It ought to be "beed" for ALL of them! So she got disgusted with that verb and refuses even to try to get it right, except for furute and conditional tenses ("I will be" and "I would be") because it's consistent with the rules there.
But the English language is rich with things to get wrong: "I ran" should be "I runned"; "she rang the doorbell" should be "she ringed the doorbell", "some deer" should be "some deers", "mice" should be "mouses". (Or "houses" "hice"). Why aren't "humans" "humen" if "women" and "men" are right? No wonder everyone hates our language.
Awkward phrasing to avoid mistakes
An ESL speaker may realize he has trouble with certain areas of English. In an effort to avoid these pitfalls, he may wind up saying things which are technically correct, but sound odd. For example, if he has a hard time remembering the rules for possession, he may says, "the coat of Robert" or "the coat that belongs to him" instead of "Robert's coat" or "his coat". Most languages don't have contractions, and an ESL speaker might never use contractions as a result.
Some English prepositions, like "to" might be indicated by word order or suffixes or prefixes in another language. Accordingly, an ESL speaker might forget to put them in when needed in English: "I took my dog the vet." I don't know how common that is, but certainly in other language they have words that serve no apparent purpose to English speakers, and which were likely to flub. (In Spanish, it's sometimes right to put the word "a" into a sentence. I don't remember where, and as I recall there was no obvious pattern to it that my Spanish teachers could explain -- it was just something Spanish speakers did, and you'd sound like a dumb American if you didn't get it right.)
A lot of writers will have ESL speakers sprinkle in very common foreign words in place of their English equivalent: The French guy says "Non" instead of "No", the Spanish one says "Sí'" instead of "Yes." I find this a little annoying, because if you know ANYTHING AT ALL about English, it will probably be how to say "yes" and "no." I don't know, maybe some real ESL speakers who are perfectly fluent otherwise do pepper their dialogue with "merci" and "bonjour" and I just haven't met them yet.
But my recommendation is to have the speaker struggle with long and/or little-used words. Lando Molari, on Babylon V, is at one point struggling to remember the English word for "duck". That's not a long or obscure word, but there's no reason that Lando would have needed to use it in day-to-day conversation (how often do you talk about ducks?) so it makes sense that he'd have learned it once and since forgotten it.
Also, the speaker might struggle with concepts that have no English equivalent, like "daibaino" in Laosian. They might use words that sound like the one they're struggling to recall: "succession" instead of "secession". Or they might use a word that's totally inappropriate because it sounds like the right word in their own tongue. A famous example: quite a few Spanish words sound similar to their English equivalent. And "embarazado" is a Spanish word -- but it doesn't mean "embarrassed"; it means "pregnant". (And if you translate "I am embarrased" as "Estoy embarazado" then you're REALLY be embarrassed.)
My one exception to sprinkling in "common foreign words" would be swearing. Since cursing tends to be something people do more from habit than thought, and more as a way of venting than communicating, it's quite likely that someone would continue to swear in their native language, rather than taking the trouble to say it in English.
A lot of idioms are unique to their own language, and a native speaker of another language wouldn't be likely to employ them. This is one reason why titles are rarely literally translated from one language to another, and why you get things like "Gundream" and "Musical Weasel Team Oyakodo" and "Bubblegum Crisis" if you do. Short phrases that sound cool in one language sound ridiculous when translated.
Accordingly, your character might not use normal English idioms like "she drinks like a fish" or "have a whale of a good time" or "try to get back in one piece". Some expressions may be actively puzzling to the ESL speaker -- "Why do you want me to break a leg?" while others they can puzzle out from the words given. Conversely, an ESL speaker might literally translate an idiom from his own language, and be met with blank stares. "I hope you enjoy competing in the skiing race, and catch the fattest fish!" "What?" "Oh ... that means, 'may you be the most successful'."
The older a character is when he learns a second language, the more likely he is to have trouble mastering it. Children pick up language, in particular, a lot faster than adults. Languages are also comparatively easy to forget if they're not used frequently. So even if your character lived in South America for five years and spoke Spanish frequently, if he's been gone for twenty, he'll probably start making mistakes.
Grammar mistakes in a foreign language are more likely to crop up if the speaker is being careless -- so if your character is excited, or scared, or otherwise emotional, he may forget to employ grammar rules that he normally uses.
And that's all I can think of at the moment. Anyone else have any other thoughts on the subject?