In singleplayer the world is saved whenever the game is paused by opening the game menu, but the chunks around the player stay loaded until the button "Save and quit to title" is pressed. Also, when a chunk unloads, everything inside that chunk is saved. Also, for both singleplayer and multiplayer, the world is saved once every 45 seconds, regardless of any other saves.
Server/Client Resynchronization Edit
If some kind Client/server desynchronization exists in the game, upon relogging/reloading the affected part of the game will be the way the server thinks it should be. Things, that only existed clientside will be gone. This means, that ghost blocks will disappear, invisible blocks will turn visible again, the position of all entities will be resynchronized, and the clientside motion of a player will be reset.
Not all of the variables required to calculate the behaviour of an entity are stored in the NBT data. This means that there is often some information lost, when reloading an entity. For most entities this is barely noticeable, because most relevant information does get stored in the NBT data, but for the following entites so much information gets lost upon reloading, that the change in behaviour can be noticed and possibly exploited.
An example of a variable used by many entites, which is not stored in the NBT data, would be the target of an entity, also referred to as aggression. If for example two skeletons are shooting each other, because they managed to hurt and consequently target each other, they will stop shooting at each other upon reloading, because there´s no information about targets stored in the NBT data.
Enderdragons do not save their deathTicks variable. This is the foundation that Enderdragon XP farms are based on. By reloading the chunk that contains a dying Enderdragon it is possible to harness most of the XP dropped upon its death without letting it die completely.
The rotation and animation status of the Enderdragon is also not stored in the NBT data.
Witches do not save their witchAttackTimer. So after reloading the time until they can launch an attack is reset.
Fireballs do not save their acceleration in the NBT data, causing it to default to zero upon reloading. However, the motion does get saved. This causes a reloaded fireball to travel a little further while decelerating to a halt, as it has no acceleration to compensate the drag (multiplication of motion by 0.95 per tick in air). [add link to Fireball isolation main article]
Previous versions Edit
Enderman (before 1.8) Edit
Endermen had a teleportDelay before 1.8, which was reset upon reloading, this stopped them from teleporting to their target for 30 ticks.
Chicken (before 1.8) Edit
Before 1.8 chickens did not save their timeUntilNextEgg variable. After reloading, this caused the chicken to wait between 6000 and 11999 ticks before laying its next egg. This means that chicken farms in earlier versions of the game need to be loaded for 5 minutes before any eggs are laid.
Riding entities (before 1.5) Edit
Before 1.5 the nbt data did not store which entities were riding which other entities. This caused entities to leave their minecarts, or skeletons to jump off their previously ridden spiders upon relogging.