Difficulties when mirroring on a home network can occur for a few reasons. Below are suggestions regarding how to address these issues.
In many cases, the firewall on your computer may be preventing the devices from communicating.
Microsoft has included instructions for allowing applications through the Windows firewall here:
If you're using a Mac, Apple has provided similar instructions here:
If you are running an anti-virus product, such as Norton, you may have to follow a similar process. This is very important as anti-virus applications often have their own firewall and network traffic blockers. It is often easier to fully disable these applications while testing for connection and then reenable and make adjustments later.
It's also possible that the firewall on your router is preventing communication. If the above steps check out, then you may need to check that your router is configured to properly allow Google Cast traffic. Most home networks will not need any special configuration, but sometimes you may need to change a setting or two on your router to allow casting on your network. These settings can vary from different model routers. You will need to reference your router manual for this process.