The Sprint is a time-box inside which all development work is contained. Think of the Sprint like an inspect-and-adapt timer. When the timer goes off, we stop, inspect our progress as well as any changes that might have occurred in the project, schedule, budget, priorities, regulatory environment, etc. Once we understand the changes, we adapt by changing the Product Backlog appropriately. Then we start a new Sprint and the timer begins again. Remember, the main purpose of a Sprint is to act as a timer to ensure inspect-and-adapt opportunities.
Sprint length is determined by the team and can really be of any length from one day to one calendar month, but we generally set Sprints in lengths of one, two, three, or four weeks.
Sprints may be terminated early by the Product Owner when the Product Owner determines that the work the team is doing is either not valuable any longer or not the most valuable thing the team could be working on.