You can varnish a painting if you want to, although it’s not required. Depending on your colors and where you’re hanging the painting, you might want to put a UV-protective varnish on your painting.
Varnishes come in all different types, but most cannot be applied until the painting is truly dry (6 months up to 2 years for thick layers of oil paint).
Gamvar is the only final varnish I know of that can be applied after a painting is touch dry. You can also use “retouching varnish” as a temporary layer that still lets the paint dry underneath. That said, I’m still learning to use Gamvar, but I don’t care for it.