« Night time | Food and hunger »

Normally in survival mode Minecraft, when you die, all items you were carrying or wearing in your inventory are scattered around your point of death while you respawn elsewhere. Until you sleep in a bed, you will spawn somewhere within 10 blocks of the world spawn point. This includes the first time when you started the game, so you can respawn anywhere within 20 blocks of where you first entered the world.

The traditional advice is to build your first shelter as close as possible to the spawn point, so if you die, you can easily find it again, or even spawn in a now-protected area. Even with the variation in where you'll come back, it's good to have a lit shelter nearby the spawn point. However, a problem with sheltering away from spawn is that if your death site is too far from where you respawn, your items may despawn while you're trying reach them. (See below for more details.)
Like any dropped items in Minecraft, the items you drop when you die will despawn (disappear) after 5 minutes, unless you're more than 180 blocks or so away, that is outside of chunk update radius The problem is that if you died at night, you will find yourself stranded without your weapons and armor, so you are quite likely to get killed again, or at least find your stuff guarded by monsters. Meanwhile, some of the monsters can actually pick up your stuff and use it against you! And if you spawned near your death scene, that 5-minute timer can easily go by before you can actually get back to and keep your stuff.
However, the above only applies until you have made and used a bed in a secure shelter. Once you've done that, you have a new option: If you get killed at night, you will respawn next to your bed, so you can just go back to sleep, and wake up the next morning — the items don't “expire” while you're asleep. It still may be worth keeping your bed out of chunk update range from where you're endangering yourself, but at least you won't be stranded outside at night.