All computer parts manufacturers publish compatibility lists online. Start with what cpu you want, and find a motherboard that's compatible (this is the hardest part). Look at the motherboard compatibility for memory and get whatever is on that list that is available and you also like (I always recommend maxing out the memory too, this will give your pc a longer usable life span). Then add a case, graphics card, hard drive, psu, disc drive, etc (most peripherals like this are more universal, so compatibility might not be a problem. Still try and check for it though). Don't forget to also buy a copy of windows (or linux if you prefer), and any other big programs like ms office, etc.
Once you get all the parts together, follow the motherboard instructions and eventually try powering up the motherboard with the cpu (and cooler), and with just one stick or ram. If you can get into bios then you're home free. Turn it off then plug everything else in. Configure bios and start installing programs as needed, starting with windows/linux.
I just rebuilt my own computer, and fully upgraded it. I probably spent $1500 on a computer that would retail for $3000+ and blow away even most alienware pc's. Be ready for dead on arrival parts though. I unfortunately went through SIX motherboard returns, two manufacturers, and two websites (amazon and newegg) before finally getting one that worked. Seriously, what ever happened to QA? I also spent several days worth of time in building it, installing and configuring windows, and install my many other programs and games. It's a long and drawn out process getting a new pc burned in and backed up too. Not for most unless you're serious about building it. Luckily the process is as simple as tab a plugs into slot a. Instructions are typically easy enough to follow and hard to screw up, so anyone determined can do it. Oh, and having a working pc or laptop, and a usb drive helps the build process too.