Civil courts in India are organised district by district, and each District Court's writ effectively stops at its own district boundary. That is precisely why the drafters of the Code of Civil Procedure could not leave inter-district transfer power with the trial court itself or with the district judge of either district alone, someone had to sit above the whole state's court system to move a case across that boundary without dispute. The High Court occupies exactly that position, exercising superintendence over every civil court in the state, so Section 24 places the power to transfer a suit from one district to another squarely with it.
This also explains why the other possibilities in the question do not hold up. Requiring the consent of both parties would let a reluctant litigant simply block a transfer that is otherwise justified, for instance where a fair trial is genuinely at risk, so the law does not make agreement a condition. Insisting that transfer wait until the trial is over would be self-defeating, since most transfer applications exist precisely to correct a problem, such as bias or inconvenience, while the case is still live, so the "at any stage" language of Section 24 rules that out too. And the court currently seized of the suit obviously cannot promote itself to decide matters outside its own district, since that would mean a district court dictating to another district court, something the hierarchy of civil courts does not permit.
Once these possibilities are set aside, what remains is the High Court's recognised power under Section 24(1) to move a suit, appeal, or other proceeding from a subordinate court in one district to a subordinate court in another, so long as the receiving court is competent to try it.
\[ \boxed{\text{By the High Court.}} \]