I think that if people are waiting for tables, and you're simply studying and taking up a table, then you should definitely be asked to leave. Is this a coffee shop that has waiters and waitresses? If it was, that's money going down the drain for them. If someone stays for multiple hours and only orders a coffee every once in a while, and then leaves a subpar tip, that's bad. They could have had 4 or 5 times as many customers in the same amount of time, with each giving a tip.
If it wasn't a waiter/waitress coffee shop, more like one where you get everything yourself, I wouldn't be so surprised either. If people are waiting in line to get a table. Enough is enough
You can study at home. Other people want to relax for a little bit too ya know!
If there was no one waiting in line, then I'd question the person asking you to leave, however.