Phones & tablets
On an iPhone: open Control Center — on newer iPhones swipe down from the top-right corner; on iPhones with a Home button, swipe up from the bottom edge. Tap the button that looks like a padlock with a circular arrow around it — that's Portrait Orientation Lock. When it's highlighted (red), your screen stays put; tap it again to let the screen rotate freely.
On a Samsung: swipe down from the top to open the quick settings panel and tap the Auto rotate tile (it may show as "Portrait" if it's locked).
One note: not every app rotates — most games and some apps stay one way no matter what, and that's normal.