After Effects is a compositing program, meant for handling dozens to hundreds to thousands of layers. Real time playback is not what it was designed for, nor is it great at it.
The previewing behavior was recently changed so Spacebar plays your timeline like a non-After Effects user would expect. However, the more effects you have, the slower this will go. If you can't get real time playback there are a number of things you can do.
For starters, check that you're not previewing a resolution higher than you need to. In the attached screenshot I have 1080p sequence but I'm only viewing it at 50%. In this case I don't need to be previewing all 2 million pixels so you can see under the right arrow that I'm previewing at half resolution. The parentheses around the word "half" mean I'm set to Auto. This is great because it will change the resolution based on my comp preview size (50%). Be careful though, anything over 50%, such as 53%, will switch that preview resolution back to full.
So, now that you have that out of the way you need to cache your timeline. Back in the day (which I believe was last year) this was called a RAM preview. You would cache frames into RAM so you could play them back in real time. After Effects loves and needs RAM. Now that terminology has changed, the Preview panel has gotten a a couple major overhauls and we're just calling them Previews these days (I think). Anyway, open the panel from Window>Preview and poke around. Like I said, Spacebar is set to just play your timeline, but if your machine has trouble then you need to alter that behavior. The old RAM Preview shortcut was 0 on the numPad. I have that set to cache my work area before playback starts. This means that you have to check the little box that says "Cache before playback" and then pick the other settings you want. There's a whole lot going on in that panel, so you're probably better off reading about it here: Preview without rendering in After Effects