Literary agents charge the writers they represent a commission on sales made: 15% is usual for home sales, but for sales in other territories a higher commission of 20% is more common. It’s usual for publishers to pay all royalties and advances due direct to the literary agent who negotiated the deal, who will deduct their commission then forward the remaining amount to the writer.
Literary agents do sometimes specify that some of the costs involved in making sales, such as photocopying and postage, will be passed onto their writers. These charges are usually only made once a sale has been completed, and then are usually taken from payments made by publishers: it is very rare for a literary agency to invoice its writers directly for such amounts. Although most agency contracts include a provision for these fees not every agent actually charges them; and as the publishing world becomes more and more digitised, photocopying and postal charges are dwindling away.
Reputable literary agents do not charge retainers, up-front fees, or charge writers if they fail to find a publisher for their books, nor do they do not charge their writers time-based fees (that is, so much a week, a month or a year) for representation.
If you’re offered representation by an agent who asks to be paid in this way don’t even consider working with them: there is no incentive for them to find you a publisher if you’re going to pay them anyway; and even if they are only ill-informed rather than ill-intentioned about how literary agents are meant to work, they are very unlikely to be able to sell your work well.