Did the country fail during the period 1866-1905?
There are surely ways in which the country failed in that era, but there are also ways in which it was very successful. There are, it seems to me, no eras in which our country has succeeded in every way or in which it has failed in every way.
You can certainly argue that the country failed African Americans and poor people during this period. During Reconstruction, African Americans got some rights, only to lose essentially all of them by the time Reconstruction ended. By 1905, segregation was firmly entrenched in the South. This is surely a failure. By 1905, big businesses had started exploiting unskilled workers. These workers worked in very bad conditions for very low pay. We can certainly say the country failed them.
On the other hand, though, the country became richer and more powerful during this era. It was during this era that the US truly became industrialized. Standards of living rose for most people during this time. In addition, the US rose to become a more important country in international affairs. By 1905, the US controlled Hawaii and the Philippines and had helped to push for the “Open Door” in China. It had won the Spanish-American War. When an era sees a country become richer and more powerful, it can be seen as a success.