The war between the United States and Mexico was fought in the middle of the 19th century. It was in years 1846-1848.
I think that this war was probably the most unjust war in which the States taken part in 19th century. That time Mexico was a very poor. It had a huge debt for about 4 millions dollars. The whole sum the country was owned USA. Mexico was almost a bankrupt. Its government was very close to collapse. These reasons prompted the Sates to rake the part of Mexican's territory. The poorest and unpopulated area was Texas. At the beginning Texas was a Spanish colony and then it became the Mexico's part. In 1821 the sate of Connecticut was established and land speculator from St. Luis and Moses Austin gave the permissions about 300 American families to settle down in Texas. Then Texas became a very attractive region. At the beginning of 1830 there lived about 20 thousand of Americans. They bought slaves, despite of the fact that the slavery wasn't allowed in that region since 1829. The Mexican government was afraid of the scale of American settlement, so they banned the further flow of immigrants from the States.
Americans settlers in Texas didn't take seriously the Mexican law and they started to set up the army. Moreover, they still kept the slaves. Many settlers came to Texas. They opted for the independence of Texas and for Texas's annexation to the USA. In 1834 the Mexicans were led by famous general Antonio Lopez de Santa Anna, who wanted to limit the Texas's autonomy. He even established Mexican new constitution. However, Texas didn't agree to sign it. And the war began. As the result of that war Texas became independent since 21st April 1836 after the battle near Rio San Jacinto. Mexicans didn't recognize the independence of Texas. They claimed that they signed the treaty under compulsion. Texas since its beginning wanted to from the start wanted to access to the United States. 12th April 1844 American government didn't ratify the Texas annexation. It was recognized as the Mexican territory. Moreover, American government was afraid to lose the balance between slaved sates and free ones.
However, the newly elected American president James Knox Polk opted for the expansion of American territory. When the government didn't agree for the Texas annexation, it had to agree for the Walker Compromise. American senate reached the agreement for Walker Compromise with 27 votes to 26 votes. That compromise gave the president the right to decide whether the Texas annexation was the only conflict issue between the states and Texas and whether Mexico should take part in negotiations. It is said that the question about the annexation of Texas should be considered was a part of political manipulation.
Polk wanted to annex a big territory such as California, Texas and New Mexico, despite of the fact that there were a lot of political oppositions. The States' interest in annexation of Texas at the beginning wasn't very great. However, when Texas became independent, Polk's interests grew very quickly. In November 1845 he decided to send to Mexico an US envoy, John Slidell, with the proposal to negotiate. Slidell offered 5 millions dollars for the purchase of Texas and about 25 millions dollars for the purchase of California.
Mexican officials didn't agree to meet with Slidell, because they didn't want to sell Texas. They considered it as a dishonourable act. They were afraid that Mexico may loose its dignity.
In January 1846 President Polk received the information about Slidell's failure, so he decided to send General Zachary Taylor to begin the occupation of the territory near the Rio Grande and then to protect the American frontiers. That area belonged to Mexico. General Taylor waited for the attack, because he didn't want to be blame for the war with Mexico.
The fights between Taylor's troops and Mexican soldiers began in May 1846. President Polk waited for the fights. As soon as possible he sent notes to the American congress. In that note he wrote: "Mexico has invaded our territory and shed American blood upon the American soil". I think that the information wasn't true, because Americans provoked Mexicans. President Polk smartly managed to manipulate the congress. Then congress banned President Polk to arm the soldiers, so Polk quickly gathered about 5 thousand of soldiers, who were mostly the volunteers.
Thanks to the press and the magnetic telegraph the manipulation of public opinion among Americans was possible. Most of them considered the Mexican war very just and US soldiers were considered as heroes. The bigger part of society thought that the American soldiers were fighting for freedom. The rush of volunteers, who wanted to join the army, was amazing.
So poor Mexican didn't have any chances to defeat the dynamic and huge neighbour. I think that Mexico was condemned to be defeated.
What is more, Mexican army didn't have any good general. Mexican soldiers were badly equipped and untrained. The States had much better equipment, the greater number of soldiers, well-prepared generals, bigger reserve of soldiers and have the supremacy on the seas, because Mexicans didn't posses any fleet. In addition, the States could be provided with European equipment and sent troops from the other side of the Gulf of Mexico.
That Mexican war was the first American war when the president was the Commander in Chief of all armed forces.
In the summer 1846 Taylor managed to win the battle with Santa Anna. Then General Taylor became the national hero. Mexicans were desperate to fight to the end. When Taylor's soldiers crossed the Rio Grande, Mexicans didn't surrender.
Later president Polk attacked the Mexican capital. General Scott was one of the generals. After some doggedness battles he managed to enter Mexico City.
Scott's success was probably the final stage of that war.
Then President Polk appointed Nicholas P. Trist to offer similar circumstances of Mexico's surrender as Slidel did before the war. However, Mexico didn't want to start the negotiations with Trist.
So President Polk recalled Trist. President Polk was very irritated because of the fact that Mexicans were so lingered. He even decided that he wouldn't pay for the territories where American settlers already had lived. Trist didn't obey the President's orders and went on negotiating.
On 2nd February 1848 Trist and Mexicans reached the tractate. In that tractate was written that Mexico gave such territories as Texas, New Mexico and California to the States and then recognized the Rio Grande as the border. United States had to pay 15 millions dollars to Mexico and they cancelled all Mexican's debts.
Polk agreed to accept that tractate.
In Mexican war poor and weak Mexico fought against stronger state. Mexico didn't have any chances to win that war. In my opinion the whole war was a dishonest game of politicians.
Then President Polk increased the United States area. He managed to add almost half-millions square miles territory to the Sates. That was thought to be a great accomplishment. The truth is that President Polk managed to achieve his aims by manipulating American congress and the public opinion. He used a kind of trick.
The Mexican war deprived lives about 13 thousands people. It cost over 100 millions dollars. The war was considered heroic and just. As it happens many times the true reasons and aims will become shown with a huge delay or never. Unfortunately, "the history is always written by a side that won".