Is every position in percentages when you support different aspect ratios? Or do you do if-else statements for each aspect ratio and put absolute positions? What are the pros and cons of each?
No, it isn't. Two reasons:
You have to deal with different aspect ratios, so percentages would lead to stretched images.
On low resolutions, pixel perfect alignment is necessary to avoid blur.
Unless you program specifically for a very limited number of devices, the if-else approach you suggested simply won't work, because there are dozens of resolutions today and there will be more in the future.*
So what we're doing is the percentage approach, except way more complicated. If you look at modern frameworks for UI development, they allow you to specify margins and padding in terms of percent, pixels, and inches on screen (which occasionally doesn't work). They also allow relative spacing i.e. "place this element exactly between those two elements".
On top of this you use the if/else approach to switch between a few layouts depending on the aspect ratio (horizontal and vertical being two big ones).
*In gaming specifically, the fixed if/else approach is unfortunately still very common.