How can I tell what RAM will fit my computer?
You can use a System Scanner from Crucial to analyse the memory that is present and recommend upgrades.
Although CPU-Z focuses on processors, it also provides detailed info about the RAM for the current computer.
Run it and note down the details in the "Memory" and "SPD" tabs and use that to determine what sort of RAM your system supports.
Note it is Windows only.
The CPU-Z "SPD" (Serial Presence Detect) tab shows you what RAM is currently installed in your computer. Most (all) motherboards support one DDR version only DDR DDR2 DDR3 etc, so you know you will need to buy RAM of the same DDR version.
Each Slot in the dropdown corresponds to a physical slot on the MB (may be empty).
You can normally install various sized RAM modules such as 256MB, 512MB 1024MB, 2048MB in each slot.
However total maximum RAM supported varies by Motherboard. Also, a 32Bit OS such as Windows XP will only be able to utilise up to 4GB of RAM, regardless of how much you install.
You can either look up your motherboard manual online or use a system information tool. Speccy from Priform and Aida32/64 which was previously Everest. These programs will tell you what size, speed/frequncy and specification of RAM you have.
Recent machines will typically have DDR2 or DDR3 RAM, and can come in various shapes, sizes and form factors (RAM for Laptops and micro machines is a smaller size of board). From Wikipedia: Top: DDR2 with heat spreader. Middle: DDR2 without heat spreader, Laptop DDR2, Bottom (OLD) Desktop DDR, Laptop PC-100
When buying RAM you need, as said, to look at Capacity (1, 2, 4, 8GB) number of modules in the kit (1, 2, etc) and the timings.
My motherboard in my desktop at home is an Asus M5A9 R2.0. The manual which came with it (plus the spec sheet on the site, and the box) showed the boards capabilties. It can support up to 32GB of RAM, consisting of 4x 8GB DDR3 RAM modules.
RAM has latency that you have to worry about as well. DDR3 comes in with DDR3-1066 DDR3-1333, DDR3-1600, DDR3-1800, DDR3-1866, DDR3-2000, DDR3-2133, DDR3-2200, DDR3-2250, DDR3-2333, DDR3-2400, DDR3-2600, DDR3-2666 and DDR3-2800, while DDR2 has DDR2-1066, DDR2-400, DDR2-533, DDR2-667 and DDR2-800. The higher the number, the faster the RAM is. Faster RAM tends to be more expensive too. In most cases, I woudln't worry about this too much, buy the same what you already have.
RAM for servers does pretty much the same, although it has a feature called ECC which is Error Checking Code which checks the data to ensure data integrity. Again, this is only used in servers and you woudln't need to buy ECC RAM for a desktop board.
It's important to note that you can't chuck in any mixture of RAM sizes and specs or slots. My aforementioned M5A9 has 4 slots, named 1, 2, 3, and 4 (just for explanation). Machines with dual-channel RAM slots (as mine is) need to be installed in pairs for better performance, so if I had one RAM module, it would go in slot 1. As I have two modules, it goes in 1 and 3 and if I had 4 modules the other two modules would go in 2 and 4. Dual-channel motherboard, with color indication of slots.
Regarding capacity, I don't really know if it's better to have 1x4GB or 2x2GB, or 2x8 or 4x4GB. I suspect it could be "more is better" enabling the RAM to work togteher.
One final thing, especially when you're building your own machine, make sure your RAM isn't too big. My RAM sits in slots 2 and 4 because the heat sinks on my Corsair RAM make it too bit to fit under my CPU heat sink, which means I'll have to buy smaller but identically specced modules if I wanted to buy any more.
PCPartPicker is very good for comparing RAM specs and prices.