The most important thing is to not get too upset when they don’t.
Playing nicely with others is a skill we spend our lives developing. It’s both simple and enormously complex, and takes a lot of practice. Most children make all kinds of mistakes along the way. They have to learn, for example, that while shoving other people and grabbing stuff is fun, in the long run it’s not a very useful strategy.
You have to see your role as a coach. They won’t automatically know how to play nice; you will have to teach them. They’ll learn by experiencing the consequences of their choices and actions. You have to make it very clear, in very simple language, what’s okay and what’s not, and then attach reasonable consequences for both. Sharing is okay, so it gets praise and fun times. Shoving is not okay, and results in missing out on time playing with other kids.