When you "sacrifice" hit points as a result of casting the life transference spell, how can you recover them? A long or short rest?
Damage from life transference can be healed by any means
The spell description for life transference (XGtE, p. 160) states:
You sacrifice some of your health to mend another creature's injuries. You take 4d8 necrotic damage, which can't be reduced in any way, and one creature of your choice that you can see within range regains a number of hit points equal to twice the necrotic damage you take. [...]
The first sentence of the description "You sacrifice some of your health to mend another creature's injuries." is descriptive, and does not contain any actual mechanical effects of the spell. The actual mechanical effects of using the spell are that you take 4d8 necrotic damage.
Notably, the spell never states that there is anything special about this damage (besides the fact that it cannot be reduced in any way); thus, for all intents and purposes, it is just like any other damage. Thus, it can be healed by anything that would ordinarily restore hit points, be that magic, short rests, long rests, or anything else.