Should I sand baseboard before painting it?
If you select boards with knots, there is a good chance that they will bleed through, even if you use a sealer or shellac based primer. The resins in knots is persistent.

Clear boards are usually used for moldings, including baseboards. You could also use MDF (medium density fiberboard) or solid vinyl composite molding. When painted, they are hard to distinguish from wood in most applications. (I think they look a little too smooth and I prefer wood). For painted applications, there is also fingerjoint molding, which is made of interlocked short pieces and is cheaper than clear boards. Much pre-primed molding is fingerjoint. Occasionally these joints may show if the quality is not high.

For wood or MDF, a light sanding with 120 grit paper is recommended to remove milling glaze and to give the wood a tooth to better take paint. An orbital sander is fine

Then prime and paint. Many prefer oil based primer on raw wood and MDF. Some vinyl says it can be painted directly, but I would also give it a sanding (or avoid it unless necessary, such as in outdoor uses).

Latex paint is fine for a finish coat, but it tends to look less smooth than oil (alkyd) based finishes. Adding a leveling agent like Floetrol helps, but nothing lays as smooth as a good oil based enamel.

(P.S.  To me, using a really smooth straight clear board, in furniture or in molding, is appreciating and honoring the wood, the tree, nature. But to each his/her own.)