As an action on your turn, you can take the Ready action so that you may act later in the round using your reaction. To do this, you need to clearly define 2 things.

First, you must decide what circumstances will trigger your prepared action. For example, you could say that the trigger is "A hostile creature comes through the door in front of me".

Second, you must decide what you will do if the triggering event happens. You may take an action such as the attack action or you may move up to your speed. For example, you could say "I will attack with my greatsword".

When you put both the trigger and the action together you get a coherent sentence. The example is "If a hostile creature comes through the door in front of me, I will attack with my greatsword".

Readying A Spell

When you ready a spell, you cast it as normal but hold its energy, which you then release with your reaction. To be readied a spell must have a casting time of 1 action, and holding onto the spell's magic requires concentration. If your concentration is broken the spell dissipates.