There are a couple of pieces to the puzzle.
The CPU chip may have an integrated memory controller (more modern) or a separate chip that talks to memory. Those chips will have some supported max configuration. They may also have configuration restrictions around banking or dram timing. The max dimm size may not be the only restriction: the exact supported dram chip configurations may be limited (this is a complicated thing to describe why not all 4Gbit dram chips are the same feature set, even if labelled DDR3 etc)
They may have supported voltage restrictions.
On the motherboard, it's possible that not all signals from the chip were routed to the dram slots. So you have to check what the max the motherboard supports. This would include restrictions on number of dimm connectors, and what kind
There could also be power restrictions, such that the laptop doesn't overheat. But most people don't worry about that. Sometimes there is more variance between dram vendors then you might expect
Then there is the problem of what the BIOS does. Nowadays, most modern BIOS's read the SPD info from the DIMM, that tells it what the DIMM supports, and programs the memory controller or CPU to make that work. But it's possible that it could be hardwired (in the old days)
So, the short answer to your question: download hwinfo (assuming this is windows) and run it (https://www.hwinfo.com/download.php )
You'll get a report on the CPU, the Motherboard, the Chipset (if any) and the BIOS, along with info on existing DIMM (good for determining voltage required and DIMM connector)
report back with all the info on the System Summary popup (snap a jpeg or just the text of the info I mentioned) and I'll tell you how I'd digest the info and decide what dimms would work (a lot of dram seller sites now also do compatibility reporting...so just knowing the motherboard may be sufficient, but good to get it all to double check)