In this tutorial, you can find out instructions to draw a seamless pattern. The fence is drawn as an example. Once you create the pattern put it in your swatches panel. After that, you can use it for the shapes just like fill color.  if you like this video tutorial, feel free to share it with your friends.

How to draw a fence in illustrator | seamless pattern design