The agent who sells your book gets 15% (or whatever the negotiated percent is--15% is standard, but not universal) of whatever you make off that book (advance and other royalties--remember that an advance is just an upfront payment of expected royalties, so it shouldn't be treated differently), whether or not they remain your agent for future projects.