It seems to generate ECDSA public keys using a BIP43 like keychain system commonly used for wallets.
So ultimately it is derived from a BIP43 like key derivation mechanism based on the comments. Like what you would see in a wallet.
I don't think there would be anything stopping you from modifying this and just hardcoding a custom vanity key.
Or somehow generating a path/keyindex that derives your vanity key.
However, most node public keys are commonly displayed in base16 so you don't have a ton of options other than making a vanity like DEADBEEF1234567890...
Given the limitation, I'm not sure if that would be worth doing.
Probably better to just define yourself through an alias.
LND specific answer
Basically the server has this identityKeyLoc property: https://github.com/lightningnetwork/lnd/blob/9c97d26cfb505081732cb457b513a356879ad57e/server.go#L160
that is used whenever your node announces itself to the network: https://github.com/lightningnetwork/lnd/blob/9c97d26cfb505081732cb457b513a356879ad57e/server.go#L2766
According to this comment here about key locators https://github.com/lightningnetwork/lnd/blob/7106ea59db9ade78d65bb46605f94637900c0e3f/keychain/derivation.go#L140
It seems to generate ECDSA public keys using a BIP43 like keychain system commonly used for wallets.
So ultimately it is derived from a BIP43 like key derivation mechanism based on the comments. Like what you would see in a wallet.
I don't think there would be anything stopping you from modifying this and just hardcoding a custom vanity key.
Or somehow generating a path/keyindex that derives your vanity key.
However, most node public keys are commonly displayed in base16 so you don't have a ton of options other than making a vanity like DEADBEEF1234567890...
Given the limitation, I'm not sure if that would be worth doing. Probably better to just define yourself through an alias.