When neither the Whigs nor the Tories are able to form a government on their own, a fragile compromise coalition government is formed, with Plantagenet Palliser, the wealthy and hard-working Duke of Omnium, installed as Prime Minister. The Duchess, formerly Lady Glencora Palliser, attempts to support her husband by hosting lavish parties at Gatherum Castle in Barsetshire, a family residence barely used until now. Palliser, initially unsure that he is fit to lead, then grows to enjoy the high office and finally becomes increasingly distressed when his government proves to be too weak and divided to accomplish anything. His own inflexible nature does not help.
A significant sub-plot centres on Ferdinand Lopez, a financially overextended City adventurer of undisclosed parentage and doubtful ethnicity (possibly Jewish), who wins the favour of Emily Wharton. She marries Lopez despite her father's objections in preference to Arthur Fletcher who has always been in love with her. As in Trollope's earlier Palliser novel Can You Forgive Her?, in which also the heroine has to choose between two suitors, the enticing and charismatic suitor is revealed to have many unpleasant traits (here Lopez's ethnic background is also presented as a factor against him), and Emily soon has cause to regret her choice. Lopez meets the Duchess at one of her parties and Glencora unwisely encourages him to stand for Parliament. He campaigns against Arthur Fletcher, Emily's popular former suitor, as well as a local tradesman, and withdraws from the contest when he sees he has no chance of winning. He then insists that the Duke reimburse him for the election expenses, since the Duchess had led him to believe that he would have the Duke's endorsement.
The Duke is furious with Glencora, who has disobeyed his explicit order not to interfere in the election, but his strong sense of personal honour forces him to give in to Lopez's shameless and desperate demands. This causes a minor political scandal when it becomes known, as it appears to many people that Palliser has used his great influence and wealth to buy a seat in Parliament for a supporter. This causes the Duke great unhappiness, but he is spiritedly defended in the House of Commons by old colleague Phineas Finn, eponymous hero of Phineas Finn and Phineas Redux, two earlier books in the Palliser sequence.
Lopez's high-risk gambles lead to financial ruin and, after trying to persuade the comparatively wealthy Lizzie Eustace (protagonist of The Eustace Diamonds) to run away with him to Guatemala, a proposition she somewhat contemptuously rejects, he takes his own life by throwing himself in front of a train at Tenway Junction, partly out fear of disgrace and partly to spare Emily whom he has genuinely loved even if he treated her badly. After a period of mourning, Emily is persuaded, without too much difficulty, to marry Arthur Fletcher.
Eventually the coalition government breaks apart and the Duke resigns, with both regret and relief, and withdraws into private life, hoping to be of use to his party again one day.

Question: Why does Ferdinand give up his attempt to join parliament?
Answer: He knows he cannot beat Arthur Fletcher.
Alternative answer: He doesn't believe he will win