The play is set in a duchy in France, but most of the action takes place in a location called the Forest of Arden. This may be intended as the Ardennes, a forested region covering an area located in southeast Belgium, western Luxembourg and northeastern France, or Arden, Warwickshire, near Shakespeare's home town, which was the ancestral origin of his mother's familyâwho incidentally were called Arden.
Frederick has usurped the Duchy and exiled his older brother, Duke Senior. Duke Senior's daughter, Rosalind, has been permitted to remain at court because she is the closest friend and cousin of Frederick's only child, Celia. Orlando, a young gentleman of the kingdom who at first sight has fallen in love with Rosalind, is forced to flee his home after being persecuted by his older brother, Oliver. Frederick becomes angry and banishes Rosalind from court. Celia and Rosalind decide to flee together accompanied by the court clown, Touchstone, with Rosalind disguised as a young man and Celia disguised as a poor lady.
Rosalind, now disguised as Ganymede ("Jove's own page"), and Celia, now disguised as Aliena (Latin for "stranger"), arrive in the Arcadian Forest of Arden, where the exiled Duke now lives with some supporters, including "the melancholy Jaques," a malcontent figure, who is introduced to us weeping over the slaughter of a deer. "Ganymede" and "Aliena" do not immediately encounter the Duke and his companions, as they meet up with Corin, an impoverished tenant, and offer to buy his master's crude cottage.
Orlando and his servant Adam, meanwhile, find the Duke and his men and are soon living with them and posting simplistic love poems for Rosalind on the trees. (The role of Adam may have been played by Shakespeare, though this story is said to be apocryphal.) Rosalind, also in love with Orlando, meets him as Ganymede and pretends to counsel him to cure him of being in love. Ganymede says that "he" will take Rosalind's place and that "he" and Orlando can act out their relationship.
The shepherdess, Phoebe, with whom Silvius is in love, has fallen in love with Ganymede (Rosalind in disguise), though "Ganymede" continually shows that "he" is not interested in Phoebe. Touchstone, meanwhile, has fallen in love with the dull-witted shepherdess, Audrey, and tries to woo her, but eventually is forced to be married first. William, another shepherd, attempts to marry Audrey as well, but is stopped by Touchstone, who threatens to kill him "a hundred and fifty ways".
Finally, Silvius, Phoebe, Ganymede, and Orlando are brought together in an argument with each other over who will get whom. Ganymede says he will solve the problem, having Orlando promise to marry Rosalind, and Phoebe promise to marry Silvius if she cannot marry Ganymede.
Orlando sees Oliver in the forest and rescues him from a lioness, causing Oliver to repent for mistreating Orlando. Oliver meets Aliena (Celia's false identity) and falls in love with her, and they agree to marry. Orlando and Rosalind, Oliver and Celia, Silvius and Phoebe, and Touchstone and Audrey all are married in the final scene, after which they discover that Frederick also has repented his faults, deciding to restore his legitimate brother to the dukedom and adopt a religious life. Jaques, ever melancholic, declines their invitation to return to the court preferring to stay in the forest and to adopt a religious life as well. Rosalind speaks an epilogue to the audience, commending the play to both men and women in the audience.

Question: Why has Rosalind been allowed to remain at court ?
Answer: She is Celia's closest friend
Alternative answer: She is a friend.