While it would be nice to win every match in Legends or Runeterra, defeat is simply part of the great circle of...card games. So you win some, you lose some, but you might be wondering what happens to your unit after it's been taken out by an opposing card.
When a unit "dies," it's removed from the board, but it's not "technically" removed from play. It's more that your card goes to the void (not to be confused with the Void, of course). Should magic, or another card, revive your fallen unit, hurray! It's back, all health restored. What's more, any buffs and debuffs are removed upon the card's "death." That way, when it comes back, it's a clean slate.
Some cards, like the Undying, have buffs that will be applied upon revival. So while any previously applied buffs will be removed, that won't keep new buffs or debuffs from taking effect.