Rains was born on April 10, 1833 in Nashville, Tennessee, the son of Methodist minister Rev. John and Lucinda Cartwright Rains. He spent his youth making tack in his father's small saddlery. A benefactor lent him $400 to attend Yale, where he graduated second in the Class of 1854 at Yale Law School. While at Yale, he was a member of the Linonian Society, and won first prize for his speech, "Is the maxim, 'Our Country Right or Wrong' worthy of our support?" . He served as headmaster at the Millwood Institute in newly formed Cheatham County. He was associate editor of the Daily Republican Banner, serving under a future fellow Confederate general, Felix Zollicoffer. Rains was an active member of the Whig Party, and was initially opposed to secession. He was elected the Nashville city attorney in 1858. He married Ida Yeatman later that year, and their only child, a daughter named Laura, was born in 1859. Rains was attorney general for his judicial district of Davidson, Williamson and Sumner Counties in 1860.
When the Civil War began, despite his personal objections to the concept of secession, Rains enlisted in April 1861 in the Confederate army as a private in the "Hermitage Guards", a local company. He was quickly elected first lieutenant, captain and finally appointed colonel of the 11th Tennessee Infantry, succeeding George E. Maney. He was commissioned May 10, 1861. The greater part of his military service was in eastern Tennessee. During the winter of 1861-62, he commanded the garrison at the Cumberland Gap and successfully repulsed numerous attempts by Union forces to seize the critical gap. It did not fall until June 1862 when Federals finally outflanked his position. His defense of the gap proved vital, as east Tennessee would have been completely lost to the Confederates much earlier in 1862. But the forces that Maj. Gen. Edmund Kirby Smith had gathered about Knoxville, in addition to those in the neighborhood of Cumberland Gap, made the Union occupation of that post almost a barren victory. In August, Smith advanced into Kentucky, leaving Maj. Gen. Carter L. Stevenson with a strong division to operate against the Union general Morgan, who was holding the gap with about 9,000 men. Col. Rains commanded a brigade in Stevenson's division. Kirby Smith's success in the Kentucky Campaign eventually forced the Union forces to abandon Cumberland Gap and retreat through eastern Kentucky to the Ohio River. Rains was rewarded for his contribution at Cumberland Gap by being appointed to and nominated for the rank of brigadier general on November 4, 1862. When Gen. Braxton Bragg was concentrating his army at Murfreesboro, Tennessee, that same month, Rains's brigade of troops from North Carolina, Alabama, and Tennessee traveled to Murfreesboro and was assigned to the division of Maj. Gen. John P. McCown in Hardee's Corps. At the Battle of Stones River on December 31, 1862, Rains was shot through the heart and killed instantly while leading his brigade forward in an attack against Union artillery. His last words were "Forward my brave boys, forward!" The Confederate States Senate had not acted to confirm Rains's nomination as brigadier general on the date of his death. Rains was initially buried on the battlefield, but Rains's father, wife, Ida, and 3-year-old daughter, met with Union Maj. Gen. William Rosecrans and formally requested General Rains's body. It was transferred through Federal lines and reburied in the Nashville City Cemetery. In 1888, Rains was reinterred in the Confederate section of Mount Olivet Cemetery in Nashville.