WASHINGTON — The days ahead could be decisive ones for the main pieces of President Obama’s second-term agenda: long-range deficit reduction, gun safety and changes to immigration law. With Congress back this week from a recess, bipartisan groups of senators who have been negotiating about immigration and gun violence are due to unveil their agreements, though prospects for a gun deal are in question as the emotional impact of the massacre in Newtown, Conn., has faded and the National Rifle Association has marshaled opposition. And on Wednesday, Mr. Obama will send his annual budget to Capitol Hill intended as a compromise offer, though early signs suggest that Republican leaders have little interest in reviving talks. Members of both parties say Mr. Obama faces a conundrum with his legislative approach to a deeply polarized Congress. In the past, when he has stayed aloof from legislative action, Republicans and others have accused him of a lack of leadership; when he has gotten involved, they have complained that they could not support any bill so closely identified with Mr. Obama without risking the contempt of conservative voters. Representative Chris Van Hollen, Democrat of Maryland, called this predicament Mr. Obama’s “Catch-22.” And Senator Mark Warner, Democrat of Virginia, said he had often seen it at work since 2010 while negotiating with Republican lawmakers to reach a long-term budget agreement. At times, Mr. Warner said, Republicans would urge him to get Mr. Obama more involved, saying, “Gosh, Warner, we’ve got to have the president.” Other times, he said, the same lawmakers would plead otherwise, saying, “If the president comes out for this, you know it is going to kill us in the House.” “Everybody wants him involved to the right degree at the right moment,” Mr. Warner said, “but not anytime before or after.” The challenge for Mr. Obama became evident as soon as he took office, when Republicans almost unanimously opposed his economic stimulus package even as the recession was erasing nearly 800,000 jobs a month. The author Robert Draper opened his recent book about the House, “Do Not Ask What Good We Do,” with an account from Republican leaders who dined together on the night of Mr. Obama’s 2009 inauguration and agreed that the way to regain power was to oppose whatever he proposed. Though Mr. Obama was able to prevail over Republican opposition in his first two years as president because Democrats had majorities in the House and the Senate, that changed when Republicans won control of the House in 2010, giving them a brake to apply to the president’s agenda. Other than the stimulus experience in early 2009, the moment that most captured that polarization for the White House occurred a year later. In early 2010 Republican senators, including the minority leader, Senator Mitch McConnell of Kentucky, demanded that Mr. Obama endorse bipartisan legislation to create a deficit-reduction commission. But when he finally did so, they voted against the bill, killing it. Now the president’s three pending priorities are shaping up as test cases for how he and Republicans will work together — or not — in his second term. Each measure — on the budget, guns and immigration — in its own way illustrates the fine line that Mr. Obama must walk to succeed even with national opinion on his side. Privately, the White House is optimistic only about the prospects for an immigration bill, which would create a path to citizenship for about 11 million people in the country illegally. That is because an immigration compromise is the only one that Republicans see as being in their own interests, given their party’s unpopularity with the fast-growing Latino electorate. In contrast, most Republicans see little advantage in backing gun legislation, given hostility toward it in their states or in districts throughout the South and the West and in rural areas. A budget compromise would require agreeing to higher taxes, which are anathema to conservative voters, in exchange for Mr. Obama’s support for the reductions in Medicare and Social Security that they want. Yet even on immigration, many Republicans are weighing their party’s long-term interests in supporting a compromise against their own short-term arguments for opposing one: antipathy remains deep in conservative districts to any proposal that would grant citizenship. That calculation also holds for Republicans planning to seek the 2016 presidential nomination. Against this backdrop, Mr. Obama early on outlined elements that he wanted in the immigration and gun measures. Then he purposely left the drafting to Congress. Senior aides, mainly the chief of staff, Denis R. McDonough, and the deputy chief of staff, Rob Nabors, check in daily with senators. Vice President Joseph R. Biden Jr. stays in touch with his former Senate colleagues about the gun bill talks.