If there is a defined end. Otherwise until space technology is mastered or something like that.
There are several main factors as to how long Civ IV games last.
1) Game speed setting The difference between quick (everything is 33% faster build/research) and marathon (everything is 300% longer to build / research) also manifests as an actual increase in total number of turns. (I think "normal" defaults to 500 turns?)
2) Game Map Size Map size can change the length of victories immensely. Small maps favor conquest or domination victories. Larger maps (with the chance for more science producing cities) lend themselves to (marginally) faster space and Cultural victories.
3) Victory Settings As mentioned by Marco elsewhere in this topic, there are several different victory conditions. Some of these (Conquest / Religious / Time) can be reached markedly sooner than others (Cultural, Space Race, Diplomatic)
4) How you play the game Do you automate everything and press "enter" to skip turn after turn? Are you a conquest-minded gamer who needs to micromanage large armies as you expand your empire? There's no easy way to determine how much time a single turn will take.
The bottom line is that a standard Civ IV game will happen over hours, if not days. (Though you may quit at any time, receiving a "Time" "Victory")
Edit: Added "Game Map" as suggested.
It depends on the Victory Conditions you have set at the beginning of the game. The game ends when one of them is reached.
These can be:
- Conquest Victory: eliminates all rivals
- Domination Victory: conquest a certain percent of the world's population and global land mass
- Cultural Victory: reach legendary culture with 3 cities
- Space Race Victory: let your ship arrive to Alpha Centauri first
- Diplomatic Victory: be elected to a achieve diplomatic victory by the players by garnering 75% of the "Yes" votes
- Time Victory: get the highest score at the end of the game (2050AD)
summarized from CIV IV page on Wikipedia