The immediate goal of Tetris is always the same no matter what version you play: clear rows from your stack by filling the entire row with tetriminos. However, the long term goal will vary based on the version of Tetris you are playing, and the selected game mode. Below is a description of the most common game modes that you will find in various versions of Tetris. There are many other modes of play introduced in different versions of Tetris besides those listed here. Modes unique to a particular version of Tetris are discussed on that version's page.
Endless mode: no limits
Also known as A-Type. Endless mode is the most traditional mode of Tetris, and has existed since Tetris was first developed. In this mode, the game plays forever, ending only when a new piece can't be introduced at the top of the matrix without colliding with the existing stack. The level, and therefore the speed at which the tetriminos fall, increases with every ten lines cleared. Although players traditionally start at level 1, many games give players the ability to select their starting level, usually up to level 9.
Marathon mode: limited levels
Marathon mode is very similar to Endless mode, with the only major distinction being that it is finite and not endless. It is common for most Marathon modes to end once the player successfully clears level 15. Marathon modes don't always require ten lines to be cleared before the level increases. Rather a varying number of lines must be cleared, sometimes starting as low as five, and increasing as the player reaches higher levels. The starting level may not be selected. Since the game ends upon clearing level 15, the goal is to achieve the highest score possible in those 15 levels.
Sprint mode: limited lines
Also known as B-Type or 40 Lines. Sprint mode is a competition to clear a certain number of lines in the fastest amount of time possible. There is great variability in this mode across different versions of Tetris. In most of the newer versions, the number of lines to be cleared is 40. However, some versions, particularly older consoler versions, require a lower number of lines to be cleared.
Nintendo's version of Tetris for the NES and Game Boy refer to this mode as B-Type, and only require the player to clear 25 lines. They also allow the player to select the level of play (which does not ever increase), and how many rows of random blocks they would like scattered throughout the Matrix upon starting the game. Time was not kept in this version; you either successfully removed 25 lines or you didn't. Special victory animations were presented for clearing this mode on the hardest level, and the animations grew more elaborate depending on how high the random blocks began.
Ultra mode: limited time
Also known as Time Trial. In this mode of the game, you are given a set time limit, traditionally two minutes, but sometimes three minutes in other versions, to clear as many lines as possible. Once time runs out, the game ends, regardless of how many lines you clear. It is also possible to end the game prematurely if you fill up the Matrix and top out. Some versions of Tetris allow you to select a Level before beginning to play.