The 419 Scam takes a very specific form in fiction: someone is contacted by a Nigerian guy (who may or may not be royalty) with a huge sum of money in a bank account which he can't access without the mark's help. You'd think that if it were codified sufficiently to be a trope, people wouldn't fall for it in Real Life. But you'd be surprised; some people do still fall for this scam, and others fall for different versions of the scam that don't follow this pattern. Let's take a look:
The biggest question you're probably asking is why so many perpetrators are from Nigeria. The answer is that they aren't — many are just pretending to be Nigerians. This, of course, raises a different question — why would a scammer pretend to be a Nigerian if people associate Nigeria with this type of scam?
Scammers need their marks to be pretty stupid. They don't want anyone looking too closely at what they're doing and pulling out before they get their money; it's a waste of resources, and they risk getting caught. As such, by contacting people pretending to be Nigerians, they're likely to get responses only from people so naïve that they're unaware of this trope. This is also a reason to pretend to be Nigerian royalty even though Nigeria is a republic. It's another way to weed out the people who are too smart/savvy for this scam to work on.
As for scammers that are from Nigeria, it's far more likely they'll pretend to be from somewhere else. A popular choice is posing as American military with photos gleaned off social media, romancing lonely women online and wooing them out of their life savings. The lies may differ but otherwise it's the same scam. The problem has gotten so bad that Nigeria has a very dire reputation among investors, which is seriously affecting investment opportunities in the country. The Nigerian government is trying to crack down on the practice, but scammers often use the money they gain to bribe officials into backing off.
419 scammers can come from (or pretend to come from) places other than Nigeria. They can come from much richer places like Britain or The United States; this allows them to blame strict regulatory environments on their inability to access the money, tricking the mark into helping the scammer rebel against a powerful, prosperous country who has done him wrong. India is home to a computer variant where they pretend to be tech support and ask for your password, bank account details, or other information; these scammers prey on people's unfamiliarity with computers and the relative Indian expertise in that field. And in recent years, Syria has become a country of choice, as it's in the middle of a civil war and a rich oil sheikh could plausibly claim to have been screwed over by the Assad regime.
As for the name, the first scammers that followed the "Nigerian prince" pattern were actually from Nigeria, and the number 419 refers to the section of the Nigerian Criminal Code that penalizes fraud.
The scammer usually sends out a boatload of emails or private messages to prospective marks, hoping he'll find someone gullible enough to respond. To do this, he'll often adopt a fake identity with a ridiculously common name. His English will generally be full of errors, which may be deliberate to catch inattentive readers or trick the mark into thinking he can outsmart the "idiot foreigner".
The typical story involves a large sum of money in a bank account or trust fund to which the scammer is entitled but which he cannot access for whatever reason. The question of why a supposed prince cannot access this bank account or trust fund is not really addressed, or is Hand Waved with a story about political difficulties. The money, of course, does not exist. The scammer asks the mark for help, promising a substantial share of the imaginary funds (usually at least 10%) in exchange. The problem is that the scammer typically needs some of the mark's money to complete the transaction; trivial payments at first to apply processing fees, create new authorization documents, or perhaps to bribe an official. The scammer often fails to mention this in his first email, only bringing these costs up later as an unexpected snag; he can keep doing this for as long as the mark is willing to send the funds. Typically, the scammer will ask for the money by wire transfer like Western Union, which can be sent anonymously and allow no recovery; as such, it's virtually impossible for the mark to get their money back. A particularly nasty variant ends with the mark being lured to the scammer's home country, where they're kidnapped and ransomed, or beaten and mugged (and, sometimes, even flat-out murdered). In some cases, the scammer may keep pushing and pushing for more money, until the victim is completely bankrupt, with some victims having made the decision to end their life rather than suffer any more.
It doesn't have to be over the Internet; this kind of thing has been going on for decades with phone calls and snail-mail. And they still do use these methods today, usually looking for technologically-challenged marks who might be more gullible, particularly the elderly.
There are other stories scammers can use to hook the mark. One is to tell them they've won a lottery in a foreign country (which they never entered into) but they'll need to pay processing fees or whatever to transfer the money. Another is to tell them that a Long-Lost Relative living abroad has died and left them a substantial amount of money, but the mark has to pay fees to "speed things along" or fix some legal snafu. A stranger variant is where the scammer is a Phony Psychic, who promises that if the mark sends him money, they'll become rich in the future just because (and they'll find love and be cured of whatever ails them).
Another variant is for the scammer to actually send the victim a check, which they are told to deposit (not cash) at their local bank. It will be for around $4500, as banks have the option to put a "delayed availability hold" on any check over $5000; without the hold, the check will clear right away. Then the scammer will tell the victim that he needs some of the money back (either to pay the unexpected fees, or just because the check was for too much because of a clerical error), so the victim can withdraw the requested amount (usually about $500 to $1000) from the account and send it back — the check cleared, so the money is there. It could take the bank up to three weeks to confirm that the check is fraudulent, at which point the bank pulls the money back (and charges the victim a fee), while the scammer makes out with up to $1000. As banks' check verification processes have gotten faster, it's slowly falling out of favor, but it still happens far too often. Prepaid debit cards have become a popular choice for the scam as well, as they have less stringent verification processes.
A particularly interesting variant is for a mark who has already been burned to receive a second message from an agency like the FBI claiming that they can help the mark recover the money lost in a 419 scam; some even claim that the original millions can still be reached. For whatever reason, they nearly always start with the line, "Attention: Beneficiary". At least one third-level message has even been spotted, targeting people who fell for the original scam and the fake FBI scam; this, thankfully, seems not to have caught on, giving us hope for a limit to human gullibility.
Why does this even work?
Despite the prominent trope, the poor English, and the dubious legality of the proposed arrangements, hundreds of thousands of people have fallen victim to the 419 scam. Most of them are either particularly naïve and trusting, particularly greedy, not particularly attentive, or some combination of the three.
As explained, scammers like to make themselves look dumber or more vulnerable than they really are. This allows them to find marks who are as dumb as they're pretending to be, are too naïve to understand the trope, or fancy themselves as smart Westerners who see an opportunity to get rich at the expense of an idiot from a third-world country. Once they're hooked, they stay with the scammer because of the Sunk Cost Fallacy; they've invested so much in the game already, they can't afford to stop now.
And victims seldom go to the police once they realize they've been duped. Part of it is embarrassment at falling for the scam, and part of it is that they've been playing a game with nefarious motives. After all, if the story was true then they'd be committing bank fraud. As such, the reported losses to the 419 scam are likely much lower than the actual total.
But two can play at this game, and the prevalence of the trope has led to the concept of "scambaiting", where a clever mark initially plays along, but then forces the scammer to do embarrassing or time-wasting things without sending them the money. Now it's the scammer whose greed keeps them in the game, and successful scambaiting has led to these guys being arrested, getting marooned in the African jungle, or making complete fools of themselves in public. Scambaiters do it partly for their own amusement, and partly to keep scammers occupied and unable to find real victims. If the scambaiters record or livestream their endeavors, then they also can provide entertainment for an audience while at the same time helping them to avoid becoming victims themselves.
Back to 419 Scam.