I had heard some people say that they just stick the flower stems in the cake and others say not to do that since chemicals can come out of the stems and into the cake.
Michaels Craftstore has this tool called FreshFlower Cake Spikes you can use those.
Edited to Add...it keeps the flowers in place and the flower isn't coming in direct contact with the cake.
I use the fresh flower spikes from Wilton for fresh flowers, you can put a tiny bit of water in them to keep the flower fresh.
For fake flowers I use drinking straws to keep them from coming in contact with the cake and it gives them extra support.
Enjoy your day!