I think I've read an article about it a while ago, but can't find it again.
At first, phasing sounds complex, but it is actually rather simple. Plus it has been done before, although to far less extends (e.g. in World of Warcraft).
What basically happens is that the game will periodically decide what you should and shouldn't see. By default, you'll always see everyone else being in the same instance of the current area (all areas in ESO are instanced, except the named Cyrodiil campaigns). So if there are too many people for one instance of an area, a second one is created. Players don't notice this and they're not moved between them by default (people entering the zone are simply placed in the less populated version; you can also switch these by quick travelling to another player).
But I'm getting a bit off-topic, so back on topic: Within zones of the game there can be specific areas, for example the village you've mentioned.
When a player enters such an area, the game will dynamically decide which content you should see based on your own quest decisions or quest progress. If you've rescued the village, you'll see the aftermath version. If you still haven't done so, you'll still see the quest being under attack. In addition, the game will try to hide players that have a different progress and aren't in your own group.
There's also another possibility that only single NPCs or objects will appear or disappear based on your own progress (or they're simply exclusively shown to you only). However, this last version only ever happens with passive things like objects or friendly NPCs. If there's combat involved, you can be sure that there's always the whole area instanced. You'll never be attacked by an enemy your friends can't see (while still seeing you), unless there's some networking problem.
Due to all these things it is possible that you see players fading in/out once they're crossing the borders of such areas. They could also stand in an empty place but their own "version" of the game has an NPC there.
When grouped up, all these things will act a bit differently. The game will usually try to keep you together and visible, but there are instances where you won't see your group members. Instead you'll only see the arrow that's usually above their heads. This only happens if your progress varies radically (e.g. the mentioned village pre/post attack) or if you're put into different instances before forming a group.