But how do I put an emphasis on a beat? Do I play it louder? Do I play it longer?
Now that does not seem like an overly helpful answer. The most important thing is that you feel the importance of the beats and the way they structure the music, and that your feeling is allowed to express yourself in its interpretation. For any instrument, there are a number of ways of putting expressiveness in, and all of those are, of course, affected. It's like asking which parts of your body should move when running. Some parts are more important than others, some are more directly affecting your running, but you would not say that anything should not move.
Take a harpsichord which does not have dynamics at all. Can you stress beats? Of course you can. You can put a more poignant arpeggio on chords, you can cut the preceding notes short a bit, you can make the next beat come somewhat late in comparison and so on.
But all those are ways to stress things that are "organic", flowing out of the way the instrument is an extension of your musical mind.
So the first point is that those beats should be important to you. Once that is the case and the instrument becomes more of an extension of yourself, the importance for the listener will evolve in the manner in which your ways of expressing musical meaning with the instrument evolve.
Anything which is done explicitly is in danger of ending up overdone, in particular when done isolated from other techniques of stressing the music.
So if you have a recording, the first step may be just knocking the beat on a table. Rocking your body along might also help, but there is a danger that you get into the habit of accompanying your play with excessive movement, and that tends to distract the audience rather than make it go with you: where the expression counts is the music. So if you allow it to escape via side channels, that may detach your audience's contact with the music as compared to your own.
When you play in 4/4 time, which is the most common, beat 1 is emphasised by playing it a bit louder than the other three. Often beat 3 is also a bit louder. So - 1 is pressed hardest, 3 the next level down, with 2 and 4 the relatively quiet ones. Usually this is quite subtle, but sometimes when learning a new piece, it's helpful to emphasise beat 1 to keep the piece in shape.
You only hold notes on for as long as they are written. A one beat (quarter/crotchet) note will last just that long, whether it's beat 1,2,3 or 4.
In 3/4 time, the first beat is the only one that gets played slightly louder than the others, whereas in 6/8, it's beats 1 and 4, as in ONE two three FOUR five six.These are the main times you'll be playing in, so we'll not go into other time signatures.
When you've played for a while, it becomes second nature (or should !), and you'll find that you won't make a lot of definition of beat 1 all the time.Sometimes a phrase will go over three or four bars, so the first note of it is the more emphasised one.
This answer is a bit of personal color to complement, perhaps, user15590.
I'm an adult piano learner, building on music I learned in school as a child. Based on my early education, I came to piano expecting that 'a beat was a beat', except, perhaps, in some soppy sloppy playing of an overly romantic nature.
My piano teacher, a woman of endless patience, just kept pushing me to find expression. I was only worried about mistakes. She has faith that accuracy will arrive in time and practice, and that the essence of learning is expression. Over time, it dawned on me that a beat is never 'just a beat'. Even Bach isn't math. The more I've read about historical performance practice, the more I've studied annotated scores, and the more I'd tried to let some idea in my head somehow turn into sound, the more I've realized that it's all about micro-variations in note values. Even if the notes are living in precise boxes, which they hardly ever are, the percussive nature of the piano means that each one has an attack, and every one calls for a decision as to what that is going to be. A decision you make not-too-consciously as you set out to make your music feel like something.
So, to answer the original question: maybe you play it a bit louder. Maybe you play it a bit more statacco. If the overall passage is ff, maybe you even play it a little softer. Maybe you steal a tiny amount of time from the next beat and add it to this one. Over time, you'll come to do all of these things without thinking, explicitly, about any of them.
It's also become clear that composers come in a variety of stripes. Some notate exactly what they want with great precision. Others notate rather broad ideas of what they expect, and leave it to the player to figure it out. You have to realize dolcemente somehow, and there's no precise recipe.
Have a strong inner metronome-- count in your head the time signature: 1, 2, 3, 1, 2, 3, etc. You will naturally accent the downbeat. After some practice, you will not need to consciously count in your head.
Honestly, you shouldn't try to pay a lot of attention to the downbeat and risk overemphasizing it. It could become a nasty habit that makes you sound really heavy and juvenile as you play more advanced music that requires a little more finesse when emphasizing certain sections of the measure.