When Pakistan holds an election, there’s an established pattern to how things generally play out.
The military selects a preferred candidate (in this case Nawaz Sharif), and then discredits/exiles/imprisons the main challenger (in this case, Imran Khan). The vote is held and the military’s preferred candidate wins. It’s no wonder they are known inside the country as “the generals’ elections”.