First of all, Codraroll is absolutely right in that Pokemon will last until they no longer make money. As for how long it will take to bring down the franchise as a whole, it'll take a while, much more than a decade. Quality wise, it may not be able to hold on for much longer, and the Pokemon games might devolve into shit someday. But even once that happens, Pokemon will continue to live for years. Even if the games stop becoming good, they will still sell very well simply because of the brand name. The brand name of Pokemon will be enough for the franchise's future games to move plenty of units. Just look at Call of Duty for instance. That franchise continues to give us the same shit over and over every fucking year, yet every game, no matter how stale the franchise has gotten, still sells well because it's fucking Call of Duty. Even when Call of Duty becomes genuine shit, it'll still sell because it's Call of Duty. The same would apply to Pokemon. Like CoD, Pokemon's brand name is so huge that even when the games start becoming shit, they'll still garner momentum for a while. Only once the people begin to truly realize how bad the franchise has become at that point of time will the Pokemon franchise start to die. Repeated failures over several years will be what it takes to bring Pokemon down as a whole.
Well honestly, that's kind of a basic thing, but looking at it now, how long Pokemon will last is much more complicated on that. Pokemon's survival is also somewhat dependent on one thing: how long Nintendo manages to survive. Pokemon is in a way one of Nintendo's iconic franchises, and Pokemon's survival will depend on how long Nintendo can afford to make hardware in the future. At this rate, Nintendo is sitting on mountains of cash, but their hardware sales are at the lowest they've ever been so far (the Wii U's sales aren't that bad but it's overall underperforming in sales and is their lowest selling console to date, and the 3DS, though technically a success, is far from garnering the same traction, attention, and fame that the DS or the Game Boy had: it's their lowest selling handheld to date), which means unless Nintendo can do a complete 180 from here, they may fall faster than Pokemon would on its own. If Nintendo falls, that will ultimately accelerate Pokemon's own downfall unless Game Freak can still make good Pokemon games (Sega isn't exactly making much good stuff with Sonic so..., but Sega has always been historically run by idiots anyways...).
That being said, I'm not sure how long Pokemon will live in its current form. Codraroll brings up a good point in that the smartphone/tablet gaming market is slowly eating away at the dedicated handheld market, which means Pokemon may not have handhelds to live on in the future. However, Nintendo is currently developing the NX, which gives an interesting twist as to where Pokemon may be headed. From what we do know, Nintendo's next console is actually a hybrid. It's both a TV console and a portable one too (two different units but ultimately both are the same console). If we assume Nintendo follows this pattern for the future, it's possible unified platforms will become a prominent thing in the near future, meaning dedicated handhelds basically merge with dedicated consoles. If we assume this possibility, Pokemon could possibly move over to unified platforms like the upcoming NX. Based on that assumption, the Nintendo NX could be the very platform that lays home to Gen 7 (aka next gen of Pokemon) of Pokemon. If the concept of a unified platform that can be played both on TV and on the go becomes the primary form of game consoles, then Pokemon can probably still hang in there and not yet migrate to smartphones/tablets and find its place on unified platforms like the NX for a while. Bottom line is, the handheld gaming market where Pokemon thrives could wind up shifting over to unified platforms like this ever so speculated Nintendo NX, and if unified platforms like NX become common, then Pokemon could still retain it current form as the handhelds it thrives on would technically become one with television consoles (one overall unit), and I'm sure dedicated consoles will still be rather popular for a while (PS4 is selling like crazy so this proves consoles are still a thing!!! Wii U and Xbox One also still have some traction).
If this NX manages to gain sizable traction (hopefully it does, just looking at the small details we know about it, namely the hybrid concept, it sounds awesome, not to mention it will have all the Nintendo goodies), then Pokemon's downfall would definitely take a long time to truly occur. From the pattern handheld gaming devices like 3DS/Vita are headed so far, and what we know of Nintendo's next platform, the NX, handhelds might not truly die, but may instead merge with the good ol' consoles that you plug into a TV and play. Overall what I am trying to say is that handhelds won't truly become obsolete just yet: so Pokemon will likely hold on to its current form for a while, maybe past two generations. With the circumstances I just said, I don't imagine Pokemon will lose its current form anytime soon, and may still find itself on dedicated hardware for a while. This is all assuming though that they even think about putting Pokemon's seventh generation on the NX: though I honestly think they should, I don't know for sure if they will (though from what we know, it seems likely).
Of course, with all that said, when you consider how popular smartphones and tablets are, I do imagine that they will still have to at least acknowledge that market too (they already kinda are with Pokemon Shuffle Mobile and Pokemon GO), but as for whether the core series will find its way onto smartphones and tablets seems rather shaky. Of course, I think it'll take a long time for Pokemon to truly become shit considering the stuff that's been integral to it for many years has continued to be an enjoyable experience, and it still is, so...). The question remains though, as to how many more Pokemon they can afford to make...how many regions...how many box mascots...how many more regions...and ultimately, how many more names for this kind of stuff.
Geez I wrote an awful lot. But this is just some of my tentative thoughts on the matter, I had a lot to say anyways...