What mistakes did the Roman Empire make that led to its downfall? Where there any main factors that caused the tribes to decide to migrate west and attack the Romans?
There are some things that the Roman's could have done to defend against the migrations, but several factors kept them from being able to do so. The main defense against the migrations would have been maintaining a consistent presence along the Rhine and Danubian borders. However, several internal issues required the Western Empire to move troops from the Rhine into the Empire's interior. So while it is possible that if they had kept up a stronger presence on the borders they might have been able to preemptively stop the migrations, the main problem with this theory, however, is the migrations occurred in such large numbers that the limitanei may have faced difficulty trying to hold back that many barbarians at once. In fact at the Battle of Mainz in 406 the Franks (who now controlled most of northern Gaul) defeated and killed some 20,000 Vandals, and yet the Vandals, with help from the Alans, were still able to defeat the Franks and enter Gaul. As for what made them migrate to begin with, well the Huns played a large role in the Gothic migration to the Danube in 376. I recently answered another question about the fall of the Western Roman Empire, and I discuss the military and some of the issues that kept the Romans from reinforcing their borders. https://www.reddit.com/r/AskHistorians/comments/98ykc4/what_caused_the_roman_empires_downfall/e4lx9ly/ For your question I'll focus more on the migrations themselves, starting with the Goths and Alans in 376.
According to Ammianus Marcellinus the Alans were the first people in the region north of the Danube to encounter the Huns, and they were quickly defeated and the survivors subjugated. The Greuthungi Goths were the next group to be defeated by the Huns, although it should be noted that Ammianus explicitly states that they were defeated by the Alans:
Vithimir who resisted the Alans for a time relying on the help of other Huns whom he had hired to support him. (Ammianus Marcellinus The Later Roman Empire, book 31)
This could mean that the Greunthungi were either defeated by the Alans that managed to flee from the Huns, or that the Huns used the newly subjugated Alans as a vanguard of sorts. Either way the Greuthungi were forced to retreat to the Dniester River, where the Thervingi Goths then set up camp in the hopes of holding off the Huns and Alans. The Huns were prepared for this, according to Ammianus, and launched a surprise attack against the Thervingi. After this the majority of the Thervingi abandoned their king, Athanaric, and followed their new leader Alavivus to the banks of the Danube, where they asked to be admitted into Empire by Emperor Valens.
Valens, who was in the middle of a war with the Persians, saw the Goths as a potential source of manpower (they had at least 10,000 men of fighting age) and agreed to allow them into the Empire. The Goths were subjected to extremely poor treatment by the Roman officials in charge of overseeing their river crossing. Ammianus goes so far as to claim that Lupicinus, the comes rei militaris of Thrace, intentionally withheld food from the Goths just so he could then sell it to them at exorbitant prices. This is probably false though as Ammianus probably disliked Lupicinus for his role in the Goth's rebellion, and thus fabricated the claim of him intentionally starving the Goths. Peter Heather in his book Goths and Romans notes that the food was most likely just being moved to a different location so that it could be properly stored and guarded, which then created a temporary food shortage. This meant that for the time being the Goths only had whatever food they carried with them, and anything the Romans had already given them. It is still possible that Lupicinus took advantage of the shortage to sell off any extra supplies he had at high prices, but he most likely did not create the shortage on purpose. No matter the reason for this food shortage the Goths were, as might be expected, were quite upset about their current situation. Due to the rising tensions among the Goths, Lupicinus decided that they should be moved closer to the city of Marcianople. If Ammianus tells it true then Lupicinus used the majority of the Danube border forces to escort the Goths to Marcianople because he feared they might rebel. But this had the unintended consequence of allowing the Greuthungi Goths, who had been denied entrance by Valens, to cross the Danube into the Empire.
Lupicinus fearing a revolt, brought up troops to compel them to move on speedily. The Greuthungi, seeing that our men were engaged elsewhere...took advantage of the opportunity to slip over on roughly made rafts and pitched their camp a long way from Fritigern. The latter, however, whose native shrewdness (this is likely Ammianus accusing the Goths of being naturally deceitful) served to protect him against any eventuality, found a wat to both obey his orders and at the same time unite himself with these powerful kings. He advanced at a leisurely pace and arrived at Marcianople in due time.
So as I mentioned earlier this was one of the events that prevented the Romans from securing their borders and allowed a large number of barbarians to cross into the Empire. The Greuthungi Goths made up a decent portion of Frittigern's army at the Battle of Adrianople in 378, which allowed the Goths to establish a permanent foothold in the Empire. Speaking of the Battle of Adrianople, another "mistake", so to speak, that the Romans made in regards to the Goths were the events leading up to their defeat in 378. After the Goths rebelled at Marcianople, they proceeded towards Adrianople which is only 130 miles from Constantinople. This meant that the Empire's capital was now at risk, and Valens had to make a hasty treaty with Persia and march back to the city. He then quickly set out to meet the Goths at Adrianople, and this is when he began to make several key mistakes. Firstly it should be noted that the Goths were defeated in a small battle in Thrace by the general Frigeridus, who was actully the Western Emperor Gratian's (the teenage nephew of Valens) general. Gratian had to recall Frigeridus however as the Alamanni began to threaten his border along the Rhine. After this Valens gave command of the army in charge of defeating the Goths to Sebastian. Sebastian also managed to inflict a defeat upon the Goths, which is what probably forced them back towards Adrianople. Gratian also managed to win his own great victory over the Alemanni after he crossed the Rhine into Germania. These events are all important because according to Ammianus' account Valens had grown quite jealous of his generals and his nephew, because despite being Emperor he still did not have a great victory that he could claim.
So he marched from Melantias, eager to put himself on a level with his nephew, whose exploits irked him, by some glorious deed of his own.
According to Zosimus, who wrote his history over 100 years later, Valens was also egged on by his other generals because they were political enemies of Sebastian (something that can be easily believed in the context of Roman politics). Thus Valens was more than willing to engage the Goths rather than wait for his nephew to arrive with reinforcements, especially since Gratian's victory over the Alamanni is the reason he had not already arrived, but to make matters worse his scouts returned with errant reports of the size of the Gothic army. According to their reports the Goths only had around 10,000 men, but they had actually only seen a portion of the Goth's army, as most of the cavalry was probably out foraging. This was the final straw that convinced Valens to attack instead of waiting for reinforcements. Once the battle began, which seems to have happened without orders from Valens, the Romans probably had a slight advantage, but then the Gothic cavalry suddenly returned to the camp. The Gothic cavalry was then able to rout the Roman heavy cavalry and the infantry quickly followed. Emperor Valens was also killed at some point in the battle. The Goths managed to inflict heavy casualties on the best field army that the Eastern Empire had at the time, which probably played a role in Theodosius' not so successful Gothic War. After this the Goths were permitted to stay in the Empire by Emperor Theodosius, who probably was not capable of amassing enough manpower in one location to successfully remove them. And of course the Goths under Alaric would later go on to sack Rome in 410 under Alaric, but my linked answer goes into more detail on that.
Another example of Roman mistakes in regards to the barbarians, is the failed attempt to retake Carthage. In the 5th century the Romans had a great opportunity to retake Carthage from the Vandals, but they failed spectacularly. The Eastern Emperor Leo, had raised an army with the intention of working with the West to retake Carthage, and gave command of this force to his brother-in-law Basiliscus. However, according to Procpius, Basiliscus agreed to a temporary 5 day truce with the Vandals. This true allowed the Vandals to prepare a fleet which then decimated the Roman fleet that was outside of Carthage. This allowed to the Vandals to retain control of Carthage for another 80 or so years before Belisarius captured the city during Justinian's wars of reconquest in the 6th century.
Sources: Ammianus Marcellinus, The Later Roman Empire Zosimus Historicus, Nova Historia Procopius, De Bello Vandallico
Peter Heather, Goths and Romans Peter Heather, Empires and Barbarians: The Fall of Rome and the Birth of Europe