Typically, the valve solders to the 1/2 inch water source pipe. the outlet is a pretty standard 3/8" compression fitting. It is a little hard to tell from your pics, but it is rare that the valve would be a threaded fitting to the water source, but not unheard of. The differences between the valves pictured are that the top pic is a 90 degree 1/4 turn valve and the bottom pic is a straight multi-turn valve. If you are going to replace them, do yourself a favor and use nothing less than a 1/4 turn stainless steel ball valve. They are available in both straight and 90 degree styles.
Assuming they are solder on, you must heat them to melt the solder and remove them, or cut them free with a tubing cutter as close to the existing valve as possible. If you unsolder them, take great care to remove all the old solder and clean/smooth the pipe end well before attempting to solder a new valve on. A basic knowledge of sweating pipes is needed for this project as well as basic plumbing tools like a tubing cutter, torch, abrasive cloth, flux and solder.