I'm a new homeowner and unsure about maintaining my roof. How often should I have it professionally inspected? Is there a best time to do these inspections? Also, I've heard about roof cleaning, but I'm unsure if it's necessary, and if so, how often to do it.
You said it's asphalt shingles in another comment. If it's under 20 years old and you aren't having issues, there's nothing for you to do.
If you're getting moss, leaf, or pine needle build up, I would clear that off with some regularity. You don't have to be militant about it, just get a broom or brush and clean it when you can. If your roof pitch is shallow enough to allow these issues then it should be shallow enough to do cleaning yourself. If the pitch is so steep you'd want to hire someone then you probably don't have these issues.
I would never call any part of a house "set and forget". But correctly installed asphalt shingle roofs are made to last 20-30 or more years with little to no maintenance during that span. Since you're new to the home I don't see any harm in having a professional inspect it to get a read of where you're at. They should be able to give you an estimated remaining lifespan and advice on things to watch for specific to your roof.
if the gravely stuff is coming off, its time to replace
if it builds up with leaves or something, get them off when you can
if its growing moss, have someone treat it
I only get it cleaned when it is building up, otherwise just look at it once a year and think about what it needs, usually when its gutter cleaning time
Do you know how old the roof is? If not, assuming your jurisdiction requires permits for roofing work, you should be able to find the permits for the house and see when the last roofing permit was issued. Some areas let you browse all permits online (this is the case in my area), whereas others are more old-school and require you to physically go to City Hall (or similar) and view hard copies of the permits.
Asphalt shingle roofs generally last 20-30 years. If it's getting towards the upper end of that limit, you'll want to consider replacing it.
Try to keep trees trimmed back away from the roof if possible.