Here is my scenario, I bought a new Samsung SSD 840 Pro and replaced my old drive in my Lenovo ThinkPad W520. I installed a fresh copy of windows 8 on my machine. Apparently it didn't install UEFI boot, I checked the bios setting and it says Legacy. I went into my bios and turn the UEFI boot default. Still it's not boot on UEFI, I guess I need to install it again. My question is what are the steps I should follow from here to install a fresh copy of windows 8 to boot on UEFI?
Unfortunately, there's no answer to this question that applies to all systems. The problem is that different firmware designers have chosen different rules to determine when their computers boot any given medium in BIOS/legacy mode vs. in EFI mode. Your description of your firmware suggests that setting the firmware to "UEFI" should do the trick, but it might not be that simple.
Another point is that the Windows installer may detect your existing partition table and refuse to install even if you successfully boot the installer in EFI mode. Thus, you may need to completely wipe the partition table, or even create a fresh GUID Partition Table (GPT), before you begin the EFI-mode installation.