1) Attack Submarines (e.g. Los Angeles-class & Virginia-class for USN) which usually roam within a designated operations area, surveilling, tracking, and generally keeping tabs on other nations' surface & sub-surface fleet dispositions. These subs typically have multi-week sorties and may intermittently surface for surveillance & comms.
2) Ballistic Missile Submarines aka "Boomers" (e.g. Ohio-class for USN) which are given a strategic area in which to operate and their objective is to remain silent & undetected, waiting for the hopefully-never-coming order to launch their SLBMs. These subs usually have multi-month sorties and often don't surface until the end of their patrol.