Cape Verde, in their second-ever appearance in the Africa Cup of Nations knockout stages, had Patrick Andrade shown a straight red card after 20 minutes, before goalkeeper Vozinha was also sent-off in the second-half after a heavy collision with Mane.
The Liverpool forward put his side in front shortly after, despite still looking dazed, as Senegal eventually found their way through a stubborn defence. Cape Verde were in it right until stoppage time, when Bambia Dieng sealed the win on the break.
Senegal will now face Mali or Equatorial Guinea in the last eight.
After a string of lethargic displays in the group stage, Senegal came flying out of the blocks and very nearly made the perfect start.
Saliou Ciss burst down the left wing and his cross eventually fell to Mane, who smashed an effort against the post after just 40 seconds. Senegal continued to pin Cape Verde back, and Idrissa Gueye should have down better with a free-kick just outside the but sent an effort straight into the wall.
The one-way traffic looked set to continue when Andrade was sent-off after 20 minutes. His loose touch led to him lunging in and catching Pape Gueye high, and while he was initially only shown a yellow card, it was upgraded to a red after a VAR review.
But Senegal struggled to create much from that point onwards, as their performance increasingly mirrored what they had shown in the group stages. Mane injected some pace and drove into the box after a nice one-two, but the goalkeeper was out quickly to close down the angle before any shot could come in.
There was an improvement after the break from Senegal, Gueye going close with a decent effort from just outside the box.
Mane and Cape Verde goalkeeper Vozinha were then involved in a sickening collision as the pair clashed heads, and it was the Liverpool man who got to the ball first. Vozinha was incredibly dazed as he got to his feet and needed lengthy treatment, but the referee looked at the replays and showed the goalkeeper a red card for denying a clear goalscoring opportunity.
With Cape Verde down to nine men, the opening goal came just five minutes later. A Senegal corner was flicked away but it fell to Mane at the far post, who sent a lovely curling effort beyond the defender on the line to give his side the lead.
Mane distressingly went down as play was about to resume, clearly still feeling the impact of that collision with Vozinha, and the goal proved to be his last touch of the match as he was swiftly brought off.
Bamba Dieng nearly doubled the lead but rifled his effort into the side-netting. Some wasteful finishing meant Cape Verde had a glimmer of hope as the match moved into stoppage time, but Dieng got his goal after Famar Diedhiou squared it to him in the box as eventually Senegal sealed their place in the last eight.