The AI doesn't go after any goal in the first place, from turn 1.
The AI is programmed to to certain things if certain criteria are met.
For example, if there is an empty spot somewhere, the AI will send a settler to try to claim it.
If it has reached a certain military size, it will declare war on its neighbor.
It will chose a tech based on its value, etc.
It's a bit more complex than that, but thats how it basically works.
Once the game is over, and the player chooses to play on, the AI will simply continue according to the same rules until they are destroyed, or the player is sick of it and turns of his computer.
The only reason they don't build spaceship parts is because, like great wonders, they become unavailable once completed.