Light Yagami is one of the most intelligent protagonists in the history of anime and he has managed to do what few characters have done, do the most absolute vile actions and managed to still be adored by fans everywhere; however, Light’s full proof plan had very few but very huge flaws which ultimately led to his capture.
Light Killed the fake L
L literally had no idea who Light was and how he managed to kill so many criminals so he devised a news program and had a stand in pretend to be L. Light didn’t just take the bait, he flat out swallowed it whole as he without hesitation violated his creed of killing criminals and killed the fake L just for threatening to be in his way. Of course L’s ruse worked perfectly and this one mistake managed to do 90% of the work needed to find Light and stop him. If Light had just kept to his methods perhaps L would not have found him.
Light was too quick to react
While L figured out where Light was he was still unsure as to who he was, but Light used the fact that his dad was part of the investigation into his own murders to determine what the police was investigating. He managed to figure out exactly when L made his theories and managed to create a counter to refute each one; however, in doing so it made it very clear to L that the person doing the killings had some ties to the police which made L investigate the police and there family. While Light used this to create tension between the police and L, he did not plan for them to resolve those differences and use that investigation to narrow down the list of names further.
Light succeeded in getting the real L killed.
This would’ve worked if L was the only person Light had to contend with, but he failed to take into account that the entire world is afraid of him so a successor was likely to take L’s place. By the time L dies it was already figured out that the deathnote could only kill if the user has a face and a name and this information was provided to the new investigator Near. Since Near knew a face and a name was needed he knew the killer had to be someone that saw L’s face which was a very, very short list of people. While killing L rid Light of a huge threat, it also gave a new one almost everything they needed to figure out who he was.
Light’s circle of trust got too wide
When Light had so many eyes on him, he decided to expand on how many people he relied on to keep killing criminals and keep his identity a secret but in doing so he expanded his circle of trust so big that he couldn’t manage every aspect of it. Each person he trusted acted with little to no instruction from Light at times and these elements led the police right to the death note and ultimately Light.
Overall Light managed to spend years evading the police because he was a step ahead of them, but along the way he made errors that slowly narrowed down what Light could do and who was doing it. While Light managed to do so well the police were able to take these clues and eventually narrow it down to one man, Light Yagami. He had a nice run but he took the bait too many times, and got too hostile with his enemies with quick and lethal actions. His rash behavior left many subtle clues that on their own would not have done much, but together pointed to one, and only one person.