Length of Contract: As long as it is beneficial for them. Usually a set time period with a renewable clause.
Author Warranties: They have the right to enter into a contract regarding this work. They own the rights.
Publisher sets the price and discounts: The retail price will be based upon their costs and other market considerations.
Royalties: 10%-15% of the retail price they've set.
Advance: This is what a publisher is willing to pay you up-front for being accepted by their publishing firm. It will usually be the expected royalty for the initial print run, paid in three installments, upon contract signing, when the final manuscript is delivered and when the book is released. All advances count against your royalty, so your book sales have to surpass what they paid you initially to ever receive a royalty check.
There is a professional organization that most reputable Literary Agents belong to called the "Association of Author's Representatives - AAR). Find out if the literary agent you want belongs to and is in good standing with this association. If they are not, you need to find out why they don't belong or why they are not in good standing.
This is a voluntary membership, so there may be quite legitimate reasons for one not to join. It is an important discussion point if you are hiring a literary agent.