The 1861 decision to relocate the capital revolved around the intersection of two major factors: the relative importance of Virginia vis-à-vis the other slave states and the immediate political needs of secession in the twilight period between Lincoln's election and the outbreak of hostilities. Richmond was one of the few major metropolises of available in the South and as such it had a number of preexisting amenities and infrastructure that made it desirable for a capital. The Richmond-based Tredegar iron works, for example, was one of the few modern industrial facilities in the antebellum South. The state's historical pedigree to figures like Washington and Jefferson also made it a more prestigious choice for the new Confederate state. Richmond's proximity to DC and the North also imparted to it a more cosmopolitan appeal than other candidates being banded about in Montgomery like Atlanta or New Orleans for the members of the Provisional Confederate States Congress and the nascent Confederate government.
But these existing demographic and economic factors did not make the choice of Richmond a given in the charged political climate of early 1861. The delegates from the deep South states were leery of Richmond both because of its geographic proximity to the North, but also because Virginia was a late-comer to secession, only seceding on 17 April, five days after Fort Sumter. Both Jefferson Davis and his Vice-President Alexander Stephens favored Richmond because they recognized that firing on Fort Sumter was crossing a Rubicon in which secession would lead to war, therefore it would be logical that the head of the government should be proximate to the front lines, rather than in the Southern interior. The state's intact lines of communication, both railways and telegraphs, were in this logic, outweighed the danger of the state's proximity to the North. Moreover, by giving such power and prestige to Virginia, the Confederate government was sending a message to the border slave states that had not seceded the the CSA was a government not wholly dependent upon the deep South.
The motion to relocate the capital from the provisional capital of Montgomery was, though, a near-run thing. Although the motion had the support of Stephens and Davis, the deep South delegates managed to form a voting bloc that sought to bloc or mitigate the relocation bill. For some secession fireeaters, relocating the capital to a site so close to DC invited a negotiated peace with the federal government and a reconstruction of the union. Other deep South delegates were still holding out hope that their metropolises would be chosen if Richmond failed. Davis vetoed the first bill on relocation on 17 May because it only provided for Congress and the President to relocate to Richmond, but none of the other branches of government. A revised bill on 18 May almost passed the Congress as Arkansas's newly-arrived delegates favored Richmond but the Congress's quorum rules, which meant that states received no votes if its state delegates were tied and states voted as a bloc regardless of how many were present, meant that the bill could not receive a majority. But, just as the quorum rules had seemingly killed Richmond relocation, they managed to save the bill at the last minute. As a majority delegates from the deep South left at the end of the day, enough remained in session that they could again vote on the relocation measure. The remaining Florida and Louisiana delegates were persuaded to change their opposition votes, giving the bill a 6-3 margin of victory (the actual delegate vote was 24 for to 20 against).
The move to Richmond thus became a fait accompli even though some of the returning delegates decried the vote as evidence of corruption. In hindsight, the fractious politicking behind the Richmond decision was a harbinger of some of the deeper problems facing the Confederate government. Even though Richmond was a logical choice, sectional differences within the Confederacy inhibited a consensus from forming and the Confederate government had to resort to parliamentary tricks to cut through this friction. It was telling that no single alternative for Richmond emerged in the debates over relocation, with each state pushing its own interests ranging from Atlanta to Tuscaloosa. Richmond boosters were thus able to capitalize upon this lack of a clear alternative to pry away a few delegates at a key moment and have the government relocated to the Old Dominion capital.
Source
Davis, William C., and James I. Robertson. Virginia at War, 1861. Lexington: University Press of Kentucky, 2005.