By default, you lose your inventory when you die.
However, you can prevent this with a simple command.
To use the commands mentioned here, you first need to make yourself an admin.
You can learn how to do that here: How to Become an Admin.
/gamerule keepInventory true.
Important: You must save the game, otherwise the change will be reverted when the server is stopped or restarted.