The moment navy trousers clicked for me was pairing them with a grey marl jumper and white trainers for a weekend that somehow involved a lunch, a long walk and a trip to a garden centre, and realising I looked like I'd made an effort without having made any effort at all. Black felt too severe for the day, navy did the same job with none of the harshness. That's really the whole appeal in one outfit.
They're not right for everything, though. Anything that wants proper formality, a funeral, a job interview with a very traditional firm, a client meeting where black is basically the uniform, navy can read as slightly soft, slightly weekend, even in a sharp fabric. And a cheap pair shows it fast. I bought a bargain set from a chain store years ago and the navy was so flat and synthetic looking it photographed almost grey under certain lights, which is a strange thing for a colour to do but it did it. A better pair holds a proper depth to the dye, a navy that still looks like navy at nine at night under rubbish pub lighting, not washed out or purple tinged. Worth checking the fabric content before you buy, because a bit of elastane in the mix keeps the knee from bagging out after a few wears, and a lining in a tailored pair stops them clinging in a way that no amount of ironing fixes. Check the rise too, since navy trousers get worn dressed down a lot, and a low rise with a loose leg can look unfinished rather than relaxed. Pocket bags are worth a feel as well, cheap ones are stiff and show through on paler navy, which nobody needs.
As for what to avoid pairing them with, be careful with black. Navy and black together can look like a mistake rather than a choice, especially in daylight, so if you're going for a dark palette keep the rest black or keep the rest navy, don't mix the two in the same outfit unless the fabrics are different enough to make it obviously deliberate. Also steer clear of anything in a muddy brown or khaki up top, it mutes the navy into nothing and the whole outfit goes a bit flat and indistinct.
If you're between sizes, go down rather than up, since navy trousers in a cheap fabric lose their shape fastest at the waistband and a slightly snug fit holds its line far longer than a loose one does.