How would a lord/noble family be treated after surrendering in war?

by Gatlon

A question on medieval Europe...

If a castle was under siege but the lord surrendered, how would he be treated? If the war went on, would he be locked in the cells and his men killed? And if the surrender was short after the arrival of the offender (showing that there was no intention of fighting back), would the terms be lighter?

I would like an answer exploring all these situations, because it is hard to think of a king conquering territories but killing his new vassals*, either it is to think of him saying "damn, that was easy! You must be honest, so let's put you on the vanguard of my next battle" and thinking there would be 0% chance of betrayal.

*especially when he would need the castle as a strategic position

Edit: Put some needed information

Searocksandtrees

hi OP. Can you specify the geographic area (Europe? France?) and preferably time period you're asking about? Thx!