Don't get me wrong it can work out badly for you sometimes.
A friend of mine did a shirt design and got paid £100 for it, the people in question have now sold somewhere in the region of 500 shirts at £8, so yeah, he probably got the short straw, but at the time, he couldn't have forseen the success of the design.
Unless you are working for a major/massive client that can guarantee (and I mean ironclad) sales, you are entering a crap shoot of problems, involving proof of sales, how and when royalties will be paid...
As designers we have heard the exposure line enough, whilst this is tagged with financial remuneration, it is still difficult to judge.
If the client is offering a decent amount for the job and royalties, you would be a moron to say no. If they are offering you a pittance and the promise of money on sales, quote a price, don't move on it, do your thing and then hope that they come back to you when they next need artwork and you can gauge the situation better. Also, don't push for a royalty bonus if you are being paid a decent amount, it could easily put someone off.
I've done jobs for friends (and I mean close friends who I trust), where I have said, get everything made, sell some things and then pay me. But that is just me being nice.