If you're lucky
I played a few games recently(40.13). Consider this illustration clockwise from top left:
I spawned and found an upward staircase(1). After some exploring, I found rooms with dwarves and stockpiles(2) and those up/down ramps side by side nearby. And 30 some floors up there was the exit to the wilderness(3).
Otherwise, ask for help?
Another game was less successful as I didn't see any ramps around(but it was still pretty easy to find rooms with dwarves one level up from my starting position). Ask for directions maybe?
Forget that, I couldn't find something like "ask for a way out of here!" in the 9 pages of things you can ask for. After finding a seven tiles wide passage that engulfed into some underground farms that spanned dozens of screens wide, sometimes going up or down a few, I wandered into an adjacent cave and never made it back...
So I suggest you re-embark if you can't find the ramps close to the rooms where the dwarves gather.