First, read the Food Lab articles on cooking steak. tldr: Most of what you know about cooking steak is probably wrong.
Start with a decent cut. Typically, these will be cuts from the rib (Ribeye), short loin (Tenderloin, T-Bone, Porterhouse, Top Loin), and sirloin (Sirloin, Top Sirloin) parts of the steer. Whichever cut you go with should have a nice, even distribution of white fat throughout the muscle (called marbling).
Second, ALWAYS let your meat come to room temperature before doing anything to it. After coming to room temperature, salt and pepper it and let it stand at least 40 minutes before cooking, or cook it immediately.
Third, get a nice heavy pan and a high smoke point oil (like canola) and heat a thin layer of oil until it just starts to smoke. Don't let it smoke too long lest the oil break down and affect the flavor of your steak. Avoid butter as the milk solids will burn before achieving a high enough temperature.
Fourth, add your steak to the pan and flip every 15-30 seconds until desired doneness is reached. This is where most people get it wrong. Not flipping is an almost guaranteed recipe to unevenly cooked steak. The temperature in the pan will fluctuate no matter how high you have it cranked up, which undoubtedly means one side will be cooked differently than the other unless you flip enough to equalize any temperature differences in the pan.
Fifth, forget about any methods for testing doneness and get yourself a decent meat thermometer. Testing temperature is the only surefire way to making sure your steak is done to your liking.
Lastly, LET IT REST! From 5-15 minutes, depending on the thickness and cut. Not giving it time to rest is a surefire way to end up with dry steak.