Bit of a large question. Entire books have been written on the subject. Literally.
http://www.amazon.com/Server-2012-Query-Performance-Tuning/dp/1430242035/
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability