Essentially, each team that's on offense has 4 chances (downs) to gain 10 yards (or score a touchdown if they're 10 yards or less from the endzone). When they gain 10 yards, the number of downs resets.
Usually, when a team doesn't gain 10 yards after 3 downs, they kick a field goal if they are close enough to the endzone. Otherwise, they will punt the ball away to the other team. If they didn't punt and failed to gain the yards they needed on the 4th down, they would turn the ball over to the other team right at the spot where they were tackled. When they punt the ball away, then the opposing team has more yards to gain in order to score a touchdown. That's the most common way of losing possesion. Depending on the situation, teams sometimes take the chance on 4th down.
Other ways you can lose posssession are
Fumbling the football (getting the ball knocked out of your hands before you go down and the defense gets possession of the ball before the offense)
Getting intercepted (throwing the ball to the defensive team)
Safety (getting sacked in your own endzone)