It depends on the variant in question. At this moment, lichess may support whatever the PGN format (Portable Game Notation) supports. In other words, if the replay of a variant is not valid PGN, then it cannot be implemented in lichess without a considerable amount of effort.
If the recorded moves of a game of a certain variant do not comply to strict PGN standards, it cannot work. The current three-check and King of the Hill variants work because they are 100% PGN compatible, with all being altered are the win conditions.
Another wild variant taught to me by a GM 15 years ago : Black has regular pieces White has only his king and 4 pawns : c, d, e, f but gets to play 2 times in a row and put himself in check the first "phantom" move.
Hence, he can jump over a column controlled by a rook, hence, if he is 2 squares away from the other king, he mates.
Don't know if it's pgn compatible
In fact i just looked it up, it's called Monster chess :