Here's how alignment worked the last couple times I ran OD&D, Basic/Expert D&D, etc. Answer the quiz below to determine your alignment.
1) Ragnarok just started. Aligned on one side are the Kirby versions of Thor, Odin, etc. On the other side are Cthulhu and Shub-Niggurath. Where does your PC stand?
A) I fight alongside Thor!
B) I fight alongside Cthulhu!
C) Where do I stand? Are you crazy? I get the hell out of there and find a place to hide!
If you answered A your character is Lawful. If you answered B then your character is Chaotic. If you chose C then you're Neutral. It's that simple.
No other behavior matters for alignment purposes. You can sleep with your best friend's spouse and steal your grandma's last gold piece. If when the chips are down you fight alongside the inexplicable vikings with bad English accents or their proxies, then you're on the side of Law. You can fund orphanages and pay for Aunt Tilly's spleendectomy, but if you pal up with Yog-Sothoth it just doesn't count for anything alignment-wise.
Lawfuls can fight wars against each other, as can Chaotics. But if two Chaotic groups are fighting and the Lawfuls attack, be prepared for those Orcs and Goblins to suddenly act like fast friends. Good and evil, for purposes of detection spells and such, measure intentions. A man with malice on his mind detects as evil, no matter how good his previous deeds.
In short, Lawful and Chaotic are a decision (conscious or not) made by a character as to what side they are on in the grand cosmic throwdown between the barbarian gods and the outer gods. Good and Evil usually indicate a temporary state of mind. And no one is bound to any particular code of conduct, unless they take such a code upon themselves.
5e Character Sheet Update
1 hour ago