The following is from history.net at http://www.historynet.com/appomattox-court-house-battle
Information about The Battle & Surrender At Appomattox Courthouse, one of the last Civil War Battles of the American Civil WarAppomattox Courthouse Battle Facts
Location: Appomattox Courthouse, Virginia
Dates: April 9, 1865
Generals: Union: Ulysses S. Grant | Confederate: Robert E. Lee
Soldiers Engaged: Union Army: 120,000 | Confederate Army: 30,000
Outcome: Union Victory
Casualties: Union: 260 | Confederate: 440; over 27,000 surrendered
In planning for the next day, Lee informed his men that he would ignore the surrender request and attempt to fend off Sheridan’s cavalry while at least part of the Army of Northern Virginia moved on toward Lynchburg—assuming the main Union force was just cavalry. However, he asked to be informed if his men encountered any infantry, since that would mean he was outnumbered and would be forced to surrender.
Grant had spent the last week pursuing and closing in on Lee during the Appomattox Campaign. On the north side of the Appomattox River, Major General George G. Meade’s VI and II Corps were in close pursuit of Lee’s beleaguered army, while Maj. Gen. Philip H. Sheridan’s cavalry had taken a southern route to outrun Lee and surround him on the west and south.
Early in the morning on April 9, Confederate maj. gen. John B. Gordon’s corps attacked the Union cavalry blocking the road toward the railroad. Initially, Gordon had success in clearing cavalry from the road, but Union infantry moved in and he was unable to make further progress. Gordon sent word to Lee around 8:30 a.m. that he needed Lt. Gen. James Longstreet’s support to make additional headway.
Upon receiving this request—and having watched the battle through field glasses—Lee then said, "Then there is nothing left for me to do but go and see General Grant, and I would rather die a thousand deaths." Having dressed that morning in his finest dress uniform, Lee rode to the spot where he thought he and Grant would be meeting between the picket lines. There, he received Grant’s message, written the night before, in which Grant refused to meet to meet for peace talks.
Lee quickly wrote a reply, indicating that he was now ready to surrender, and rode on. Still hearing the sounds of fighting, Lee sent a letter to Meade requesting an immediate truce along the lines. Meade replied that he was not in communication with Grant but would send the message on and also suggested Lee send another letter to Grant via Sheridan. In addition, Lee also had Gordon place flags of truce along the line. As the messages moved through the lines and word of the surrender spread, the fighting stopped. Casualties for the Battle of Appomattox Courthouse were light, 260 for the Union, 440 for the Confederacy.
Grant received Lee’s letter of surrender just before noon. He replied, detailing his current position along the road toward Appomattox Courthouse, and asked Lee to select a meeting place.
Lee and his men, in searching for a suitable place to have the surrender meeting, encountered Wilmer McLean, who showed them an empty building without any furniture. When that was deemed unsuitable, he offered his own home for the meeting. It is interesting to note that McLean had moved to Appomattox after having survived the First Battle of Bull Run, much of which took place on his property in Manassas, Virginia. It is often said that the war started in his front yard and ended in his parlor, though that is not accurate.
Grant arrived in Appomattox at about 1:30 in the afternoon and proceeded to the McLean house. His appearance in his field uniform, muddy after his long ride, contrasted sharply with Lee’s clean dress uniform. They chatted for a while before discussing and writing up the terms of the surrender.
The soldiers of the Army of Northern Virginia would lay down their weapons and not take them up against the U.S. government again. Soldiers would be paroled and allowed to return home instead of being imprisoned. All Confederate equipment would be relinquished and inventoried. They agreed that any Confederate who claimed to own a horse or mule and would need it for spring planting would be allowed to keep it. Lee also requested rations for his men, as it had been several days since they had eaten, and Grant then agreed to provide them. After formal copies of the surrender document were made and the document signed, they parted. After such a long, bloody war and a particularly grim retreat, the surrender of the Army of Northern Virginia has been referred to as "The Gentlemen’s Agreement," a testament to the character of these two great men.
Upon hearing the sounds of Union soldiers celebrating the surrender by firing salutes, Grant instructed that his troops cease active celebration, saying, "The war is over; the Rebels are our countrymen again, and the best sign of rejoicing after the victory will be to abstain from all demonstrations in the field." This set the tone of the next few days, including the formal surrender ceremony that occurred April 12. Brigadier General (brevetted major general) Joshua L. Chamberlain, who had won renown at Little Round Top during the Battle of Gettysburg, was charged with officiating at the surrender ceremony at Appomattox Courthouse. He ordered his subordinate officers to come to the position of "carry arms," and on the approach of each body of troops from the Army of Northern Virginia, a bugle sounded and his men saluted. The Confederates saluted back in response and laid down their arms and colors. The formal ceremony, which saw the surrender of over 27,800 men, took nearly the entire day.
Although Lee surrendered the Army of Northern Virginia, the war was not over. There were still Confederate armies in the field and the final battle of the war would not happen until in May 12–13 in south Texas, at the battle of Palmito (Palmetto) Ranch near Brownsville. However, Confederate commanders did begin to surrender as news of the Army of Northern Virginia’s surrender spread.
On April 26, Gen. Joseph E. Johnston surrendered to Gen. William T. Sherman near Durham, North Carolina. Initially, in a meeting on April 17, Sherman offered terms even more generous than those given by Grant, but on April 14 President Abraham Lincoln was assassinated, dying the next day, and the North was not feeling magnanimous. Sherman had to return to Johnston on the 26th with new terms. Johnston, ignoring a direct order from Confederate president Jefferson Davis, surrendered all troops in the Carolinas, Georgia, and Florida.
On May 4, Lt. Gen. Richard Taylor surrendered at Citronelle, Alabama. May 10, Confederate President Jefferson Davis was captured with his wife at Irwinville, GA.
In New Orleans on May 26, Lt. Gen. Simon Bolivar Buckner, acting on the authority of Gen. Edmund Kirby Smith, commander of the Trans-Mississippi Department, accepted from Maj. Gen. Edward R. Canby the same surrender terms as Lee, Johnston, and Taylor. Ironically, Buckner had been forced to surrender the first Confederate army captured by the Union when his commanders abandoned him following the Battle of Fort Donelson in February 1862. After Buckner and Canby reached their agreement, a document was prepared and sent to Galveston, Texas, where Smith attached his signature on June 2, officially surrendering the last significant Confederate force.
Not until June 23 did Brig. Gen. Stand Watie surrender his small force of Confederate Cherokees in Oklahoma. The final act would come November 6, when the ocean raider CSS Shenandoah struck her Confederate colors in Liverpool, England.